:root {
    color-scheme: light;
    --bg: #dbe5ee;
    --panel: #ffffff;
    --ink: #0f172a;
    --muted: #5d6b78;
    --line: #cfded9;
    --accent: #0e7490;
    --accent-strong: #164e63;
    --danger: #c1121f;
    --danger-soft: #fff1f2;
    --shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    min-height: 100svh;
}

.desktop-only-screen {
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    place-items: center;
    padding: 24px;
}

.desktop-only-panel {
    width: min(620px, 100%);
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    text-align: center;
}

.desktop-only-panel p {
    margin: 0;
    color: var(--ink);
    font-size: 1.75rem;
    font-weight: 850;
    line-height: 1.2;
}

.setup-screen {
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    place-items: center;
    padding: 56px;
    background: var(--bg);
}

.setup-panel {
    position: relative;
    width: min(780px, 100%);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.setup-panel h1 {
    position: relative;
    margin: 0;
    font-size: 3.25rem;
    line-height: 1;
    letter-spacing: 0;
}

.setup-copy {
    position: relative;
    max-width: 48rem;
    margin: 14px 0 42px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.5;
}

.exam-form {
    position: relative;
    display: grid;
    gap: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.setup-panel label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.setup-panel input {
    width: 100%;
    min-height: 62px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.54);
    color: var(--ink);
    font-size: 1.08rem;
    font-weight: 700;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.setup-panel input:focus {
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.14);
}

.form-error {
    min-height: 1.3em;
    margin: 0;
    color: var(--danger);
    font-weight: 750;
}

.primary-action {
    width: min(260px, 100%);
    min-height: 58px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 0.98rem;
    font-weight: 850;
    box-shadow: 0 12px 26px rgba(14, 116, 144, 0.18);
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-action:hover {
    background: var(--accent-strong);
    box-shadow: 0 14px 30px rgba(22, 78, 99, 0.2);
    transform: translateY(-1px);
}

.primary-action:active {
    transform: translateY(0);
}

.display-screen {
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 24px;
    padding: 34px;
}

.is-hidden {
    display: none;
}

.display-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.display-header > div {
    min-width: 0;
}

.display-header h1 {
    max-width: 1200px;
    margin: 0;
    font-size: 4.8rem;
    line-height: 0.95;
    letter-spacing: 0;
}

.display-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.display-actions button {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 800;
}

.clock-panel {
    display: grid;
    align-content: center;
    justify-items: center;
    min-height: 0;
    padding: 24px 12px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.today-label {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 2rem;
    font-weight: 760;
}

.main-clock {
    display: block;
    color: var(--ink);
    font-size: 13rem;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    line-height: 0.92;
    letter-spacing: 0;
}

.sync-status {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
}

.exam-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 18px;
}

.time-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    min-height: 154px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.time-card span {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 850;
    text-transform: uppercase;
}

.time-card strong {
    font-size: 4.1rem;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    line-height: 0.95;
}

.time-card small {
    color: var(--muted);
    font-size: 1.12rem;
    font-weight: 750;
}

.status-card {
    background: rgba(236, 253, 245, 0.88);
    border-color: rgba(14, 116, 144, 0.22);
}

.status-card strong {
    color: var(--accent-strong);
}

.status-card.is-warning {
    background: var(--danger-soft);
    border-color: rgba(193, 18, 31, 0.34);
}

.status-card.is-warning span,
.status-card.is-warning strong,
.status-card.is-warning small {
    color: var(--danger);
}

.progress-shell {
    overflow: hidden;
    height: 18px;
    border-radius: 999px;
    background: #d9e1e8;
}

.progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #14a085);
    transition: width 300ms ease;
}

.wake-lock-indicator {
    position: fixed;
    left: 12px;
    bottom: 8px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: rgba(15, 23, 42, 0.48);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.wake-lock-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #c1121f;
    box-shadow: 0 0 0 3px rgba(193, 18, 31, 0.12);
}

.wake-lock-indicator.is-on span {
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14);
}

@media (min-width: 1500px) {
    .display-screen {
        padding: 46px;
        gap: 32px;
    }

    .display-header h1 {
        font-size: 5.8rem;
    }

    .main-clock {
        font-size: 15rem;
    }

    .time-card strong {
        font-size: 4.8rem;
    }
}

@media (max-width: 1100px) {
    .display-screen {
        gap: 18px;
        padding: 22px;
    }

    .display-header {
        display: grid;
        gap: 12px;
    }

    .display-header h1 {
        font-size: 4rem;
    }

    .display-actions {
        justify-content: flex-start;
    }

    .display-actions button {
        min-height: 36px;
        padding: 0 12px;
        font-size: 0.84rem;
    }

    .clock-panel {
        padding: 18px 0;
    }

    .today-label {
        font-size: 1.6rem;
    }

    .main-clock {
        max-width: 100%;
        overflow: hidden;
        font-size: 9.5rem;
    }

    .time-card {
        min-height: 138px;
        padding: 20px;
    }

    .time-card strong {
        font-size: 3.35rem;
    }

    .time-card small {
        font-size: 1rem;
    }
}

@media (max-width: 760px) {
    .setup-panel {
        padding: 30px;
    }

    .setup-panel h1,
    .display-header h1 {
        font-size: 3rem;
    }

    .form-grid,
    .exam-grid {
        grid-template-columns: 1fr;
    }

    .display-screen {
        padding: 22px;
    }

    .display-header {
        display: grid;
    }

    .display-actions {
        justify-content: flex-start;
    }

    .main-clock {
        font-size: 6.5rem;
    }

    .today-label {
        font-size: 1.4rem;
    }

    .time-card strong {
        font-size: 3.4rem;
    }
}

@media (max-width: 560px) {
    .setup-screen {
        padding: 16px;
    }

    .setup-panel {
        padding: 24px;
    }

    .setup-panel h1,
    .display-header h1 {
        font-size: 2.45rem;
    }

    .main-clock {
        font-size: 4.6rem;
    }
}
