/**
 * Lifetime Clock - スタイルシート
 */

/* ===== Variables ===== */
:root {
    --bg-color: #f5f5f5;
    --clock-bg: #fafafa;
    --clock-border: #2c2c2c;
    --text-color: #333;
    --text-muted: #666;
    --needle-red: #c41e3a;
    --needle-yellow: #daa520;
    --accent-color: #4a90a4;
    --danger-color: #c41e3a;
    --panel-bg: #fff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* ===== Container ===== */
.container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 600px;
    width: 100%;
}

/* ===== Age Display ===== */
.age-display {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-color);
    margin-bottom: 20px;
    letter-spacing: 0.05em;
}

.age-display #current-age {
    font-weight: 500;
}

/* ===== Clock Container ===== */
.clock-container {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
}

#lifetime-clock {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.1));
}

/* ===== SVG Elements ===== */
.clock-outer {
    fill: var(--clock-bg);
    stroke: var(--clock-border);
    stroke-width: 3;
}

.clock-inner {
    fill: var(--clock-bg);
    stroke: none;
}

/* Ticks */
.tick-major {
    stroke: var(--clock-border);
    stroke-width: 2;
}

.tick-minor {
    stroke: var(--text-muted);
    stroke-width: 1;
}

/* Age Numbers */
.age-number {
    font-size: 14px;
    font-weight: 500;
    fill: var(--text-color);
    text-anchor: middle;
    dominant-baseline: central;
}

/* Weekday Sections */
.section-line {
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.5;
}

.weekday-label {
    font-size: 16px;
    font-weight: 500;
    font-style: italic;
    fill: var(--text-color);
    text-anchor: middle;
    dominant-baseline: central;
}

/* Center Info */
.info-text {
    font-size: 14px;
    fill: var(--text-muted);
    text-anchor: middle;
    font-weight: 300;
    letter-spacing: 0.05em;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
}

.age-display-text {
    font-size: 20px;
    font-weight: 300;
    fill: var(--text-color);
}

.countdown-text {
    font-size: 20px;
    font-weight: 300;
    fill: var(--text-color);
}

.title-text {
    font-size: 12px;
    font-weight: 400;
    font-style: italic;
    fill: var(--text-color);
    letter-spacing: 0.1em;
}

.counter-small-text {
    font-size: 14px;
    font-weight: 300;
    fill: var(--text-color);
    letter-spacing: 0.02em;
}

/* Needles */
.needle-red {
    stroke: var(--needle-red);
    stroke-width: 4;
    stroke-linecap: round;
}

.needle-yellow {
    stroke: var(--needle-yellow);
    stroke-width: 3;
    stroke-linecap: round;
}

.needle-second {
    stroke: #4a90a4;
    stroke-width: 2;
    stroke-linecap: round;
}

.needle-tip-red {
    fill: var(--needle-red);
    stroke: none;
}

.needle-tip-yellow {
    fill: var(--needle-yellow);
    stroke: none;
}

#red-needle, #yellow-needle {
    transition: transform 0.5s ease;
}

#second-needle {
    transition: transform 0.1s linear;
}

.center-dot {
    fill: #333;
}

/* Sticky Markers */
.sticky-marker {
    fill: transparent;
    stroke: transparent;
    cursor: pointer;
    transition: var(--transition);
}

.sticky-marker:hover {
    fill: rgba(74, 144, 164, 0.3);
    stroke: var(--accent-color);
    stroke-width: 2;
}

.sticky-marker.has-note {
    fill: var(--accent-color);
    stroke: var(--accent-color);
    stroke-width: 2;
}

.sticky-marker.has-note:hover {
    fill: #3a7a8a;
}

/* ===== Settings Toggle Button ===== */
.settings-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--panel-bg);
    color: var(--text-color);
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
    z-index: 100;
}

.settings-toggle:hover {
    background: var(--accent-color);
    color: #fff;
}

/* ===== Settings Panel ===== */
.settings-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 320px;
    height: 100%;
    background: var(--panel-bg);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transition: right 0.3s ease;
    z-index: 200;
    overflow-y: auto;
}

.settings-panel.open {
    right: 0;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.settings-header h2 {
    font-size: 1.5rem;
    font-weight: 500;
}

.settings-content h3 {
    font-size: 1rem;
    font-weight: 500;
    margin: 20px 0 15px;
    color: var(--text-muted);
}

.settings-content hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 25px 0;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group .display-control {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toggle-input {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 164, 0.1);
}

.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.form-group .display-control select {
    flex: 1 1 160px;
    min-width: 160px;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ===== Buttons ===== */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    min-width: 100px;
}

.btn-primary {
    background: var(--accent-color);
    color: #fff;
}

.btn-primary:hover {
    background: #3a7a8a;
}

.btn-secondary {
    background: #eee;
    color: var(--text-color);
}

.btn-secondary:hover {
    background: #ddd;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background: #a01830;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

.close-btn:hover {
    background: #eee;
    color: var(--text-color);
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 300;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--panel-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 500;
}

.modal-body {
    padding: 20px;
}

.modal-body textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: var(--transition);
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 164, 0.1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
}

/* ===== Tooltip ===== */
.sticky-tooltip {
    position: fixed;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    max-width: 250px;
    word-wrap: break-word;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 400;
    pointer-events: none;
}

.sticky-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .age-display {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .settings-panel {
        width: 100%;
        right: -100%;
    }
    
    .settings-toggle {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .age-number {
        font-size: 11px;
    }
    
    .weekday-label {
        font-size: 12px;
    }
    
    .info-text {
        font-size: 11px;
    }
}

/* ===== Print Styles ===== */
@media print {
    .settings-toggle,
    .settings-panel,
    .modal {
        display: none !important;
    }
    
    body {
        background: #fff;
    }
    
    .clock-container {
        max-width: 400px;
    }
}

