@charset "UTF-8";
/* Simple Clock — gjsscと同じデザイントークン・コンポーネント語彙に合わせてある */

:root {
    --accent: #403999;
    --accent-dark: #322c7a;
    --accent-soft: #ece9fb;
    --accent-line: #d9d4f3;

    --ink: #1c1b26;
    --ink-2: #4a4857;
    --muted: #8a8796;

    --bg: #ffffff;
    --panel: #ffffff;
    --line: #e8e6ef;
    --line-2: #f2f1f7;

    --danger: #d0473f;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(28, 27, 38, .05), 0 8px 24px rgba(64, 57, 153, .06);
    --shadow-lg: 0 12px 40px rgba(64, 57, 153, .14);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wrap { width: calc(100% - 32px); margin-inline: auto; }
@media (min-width: 640px)  { .wrap { width: calc(100% - 64px); } }
@media (min-width: 1024px) { .wrap { width: calc(100% - 96px); } }

/* ---------- ヘッダー（このツールはログイン不要のため、ロゴだけの簡易トップバー） ---------- */
.topbar {
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
}
.topbar-in {
    display: flex; align-items: center; gap: 12px;
    min-height: 60px; padding: 8px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: block; object-fit: contain; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: row; align-items: baseline; gap: 4px; line-height: 1.15; white-space: nowrap; }
.brand-text strong {
    font-weight: 800; font-family: Outfit, sans-serif;
    font-size: 1.3rem; line-height: 1; letter-spacing: -.02em;
}
.brand-text small {
    display: inline-block; font-size: .9rem; font-weight: 600; color: var(--muted);
    font-family: 'Noto Sans JP', sans-serif; letter-spacing: 0; white-space: nowrap;
}

.page {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 32px 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 95vw;
    max-width: 1100px;
}

/* ---------- タブ（gjsscの.tabsと同じ見た目） ---------- */
.tabs { display: flex; gap: 6px; background: var(--line-2); padding: 5px; border-radius: 999px; margin-bottom: 2rem; }
.tab-btn {
    flex: 1; padding: 9px 16px; border: 0; border-radius: 999px;
    background: transparent; font: inherit; font-weight: 600; font-size: .9rem;
    color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { background: #fff; color: var(--accent); box-shadow: var(--shadow); }

.content { display: grid; }

.panel {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 250px;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
}

.panel.active {
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.4s ease forwards;
    z-index: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 数字は判読性を優先し、桁がそろう等幅フォント（JetBrains Mono）のまま維持する */
.time-display {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: clamp(4rem, 12vw, 12rem);
    font-weight: 700;
    letter-spacing: -2px;
    color: var(--ink);
    margin-bottom: 0.5rem;
    line-height: 1;
    text-align: center;
}

.date-display {
    color: var(--muted);
    font-size: clamp(1rem, 3vw, 2rem);
    font-weight: 400;
    letter-spacing: 2px;
}

.ms {
    font-size: clamp(2rem, 5vw, 5rem);
    color: var(--muted);
}

.timer-content-wrapper {
    display: grid;
    place-items: center;
    width: 100%;
    margin-bottom: 2rem;
}

.timer-content-wrapper > * {
    grid-area: 1 / 1;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.timer-layout {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.timer-setup {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timer-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.preset-btn {
    background: var(--line-2);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.preset-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.input-group input {
    background: var(--line-2);
    border: 1px solid var(--line);
    color: var(--ink);
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(4rem, 10vw, 10rem);
    width: clamp(120px, 15vw, 200px);
    text-align: center;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    outline: none;
    transition: border-color 0.2s ease;
    cursor: ns-resize;
    touch-action: none; /* スワイプ時のブラウザネイティブのスクロールを無効化 */
}

/* スピンボタン（上下の矢印）を非表示にする */
.input-group input::-webkit-inner-spin-button,
.input-group input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.input-group input[type="number"] {
    -moz-appearance: textfield;
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(64, 57, 153, .12);
}

.input-group label {
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.5rem);
}

.colon {
    font-size: clamp(4rem, 10vw, 10rem);
    font-weight: bold;
    padding-bottom: 1.5rem;
    color: var(--ink);
}

/* ---------- ボタン（gjsscの.btnと同じ語彙） ---------- */
.controls {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 24px; border-radius: 999px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 1rem;
    cursor: pointer; min-width: 120px;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--line-2); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--line); }
.btn-danger { background: transparent; color: var(--danger); border-color: #f0d5d3; }
.btn-danger:hover { background: #fdf3f2; }

.hidden {
    display: none !important;
}

.hidden-keep-size {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ---------- タイマー終了時の警告表示 ---------- */
body.alert-active {
    animation: flashRed 0.5s infinite alternate !important;
}

body.alert-active .card,
body.alert-active .tabs,
body.alert-active .input-group input,
body.alert-active .preset-btn {
    background-color: transparent !important;
    border-color: rgba(208, 71, 63, 0.4) !important;
}

body.alert-active #timer-reset {
    background-color: #ffffff !important;
    color: rgb(208, 71, 63) !important;
    border: 2px solid rgb(208, 71, 63) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

@keyframes flashRed {
    0% { background-color: rgb(208, 71, 63); }
    100% { background-color: #ffffff; }
}

.foot {
    text-align: center;
    color: var(--muted);
    font-size: .82rem;
    padding: 16px 0 24px;
}

@media (max-width: 768px) {
    .timer-layout {
        flex-direction: column;
        gap: 2rem;
    }
    .timer-presets {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .btn { min-width: 90px; padding: 0.6rem 1.2rem; }
    .timer-presets {
        grid-template-columns: repeat(3, 1fr);
    }
}
