:root {
    color-scheme: light;
    --bg-gradient: radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 24%),
        radial-gradient(circle at top right, rgba(249, 115, 22, 0.18), transparent 22%),
        linear-gradient(180deg, #f7fafc 0%, #e9eef5 100%);
    --surface: rgba(255, 255, 255, 0.94);
    --surface-strong: rgba(255, 255, 255, 0.98);
    --surface-muted: rgba(241, 245, 249, 0.96);
    --border: rgba(15, 23, 42, 0.1);
    --text: #172334;
    --text-soft: #5b6678;
    --brand: #f15a24;
    --brand-strong: #cf4315;
    --accent: #0f766e;
    --success: #138f67;
    --warning: #d49400;
    --danger: #d64545;
    --ring-track: rgba(15, 23, 42, 0.08);
    --shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-gradient: radial-gradient(circle at top left, rgba(15, 118, 110, 0.22), transparent 24%),
        radial-gradient(circle at top right, rgba(241, 90, 36, 0.18), transparent 20%),
        linear-gradient(180deg, #0b1524 0%, #08101b 100%);
    --surface: rgba(9, 18, 30, 0.92);
    --surface-strong: rgba(12, 23, 37, 0.98);
    --surface-muted: rgba(17, 29, 45, 0.96);
    --border: rgba(148, 163, 184, 0.16);
    --text: #eef4ff;
    --text-soft: #9eb0c8;
    --brand: #ff7a45;
    --brand-strong: #ed5d26;
    --accent: #20b7ad;
    --success: #2fd79a;
    --warning: #f4bc49;
    --danger: #ff7272;
    --ring-track: rgba(238, 244, 255, 0.1);
    --shadow: 0 24px 54px rgba(0, 0, 0, 0.34);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "IBM Plex Sans", sans-serif;
    color: var(--text);
    background: var(--bg-gradient);
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

button,
.sync-button,
.action-button,
.preset-button,
.settings-button,
.theme-toggle,
.icon-toggle,
.timer-card,
.center-control {
    touch-action: manipulation;
}

button {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.app-shell {
    width: min(1400px, calc(100% - 1rem));
    margin: 0 auto;
    padding: 0.75rem 0 1rem;
}

.topbar,
.timer-card,
.center-control,
.confirm-dialog__surface,
.setup-dialog__surface,
.settings-dialog__surface {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 28px;
}

.brand {
    flex: 1;
}

.brand__logo {
    width: clamp(300px, 34vw, 520px);
    height: auto;
    object-fit: contain;
}

.topbar__side {
    width: min(100%, 760px);
    display: grid;
    gap: 0.65rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) minmax(140px, 1.15fr) minmax(110px, 0.9fr) minmax(84px, 0.8fr) minmax(84px, 0.8fr);
    gap: 0.65rem;
    align-items: stretch;
}

.meta-card,
.status-pill {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 3.8rem;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
}

.meta-card__label {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.meta-card strong {
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-card--accent {
    background: transparent;
    border-color: var(--border);
}

.theme-toggle {
    width: 100%;
    min-height: 3.8rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0;
    background: var(--surface-strong);
    color: var(--text-soft);
    display: grid;
    place-items: center;
    position: relative;
    transition: transform 140ms ease, color 140ms ease, border-color 140ms ease;
}

.theme-toggle__icon {
    position: absolute;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.82);
    transition: opacity 140ms ease, transform 140ms ease, color 140ms ease;
}

.theme-toggle__svg,
.icon-toggle__svg {
    width: 1.1rem;
    height: 1.1rem;
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    transform: translateY(-1px);
    color: var(--text);
}

body:not([data-theme="dark"]) .theme-toggle__icon--sun,
[data-theme="dark"] .theme-toggle__icon--moon {
    opacity: 1;
    transform: scale(1);
    color: var(--brand);
}

.icon-toggle {
    width: 100%;
    min-height: 3.8rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--text-soft);
    display: grid;
    place-items: center;
    position: relative;
    transition: transform 140ms ease, color 140ms ease, border-color 140ms ease;
}

.icon-toggle:hover,
.icon-toggle:focus-visible {
    transform: translateY(-1px);
    color: var(--text);
}

.icon-toggle__glyph {
    position: absolute;
    display: grid;
    place-items: center;
    transition: opacity 140ms ease, transform 140ms ease;
}

.icon-toggle__glyph--sound-off {
    opacity: 0;
    transform: scale(0.85);
}

.icon-toggle[aria-pressed="true"] .icon-toggle__glyph--sound-on {
    opacity: 0;
    transform: scale(0.85);
}

.icon-toggle[aria-pressed="true"] .icon-toggle__glyph--sound-off {
    opacity: 1;
    transform: scale(1);
    color: var(--brand);
}

.topbar__tools {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

.preset-strip {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.preset-strip .preset-button {
    min-height: 2.6rem;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.settings-button {
    min-height: 2.6rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-soft);
    background: transparent;
    font-weight: 700;
    transition: transform 140ms ease, border-color 140ms ease, color 140ms ease;
}

.settings-button:hover,
.settings-button:focus-visible {
    transform: translateY(-1px);
    color: var(--text);
}

.layout {
    margin-top: 1rem;
}

.arena-layout {
    display: grid;
    gap: 1rem;
    align-items: stretch;
}

.timer-card,
.center-control {
    border-radius: 30px;
}

.timer-card {
    display: grid;
    gap: 1rem;
    min-height: 32rem;
    padding: 1rem;
    background: linear-gradient(180deg, var(--surface-strong) 0%, var(--surface-muted) 100%);
}

.timer-card__header,
.timer-card__footer {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.timer-card h3,
.setup-dialog__surface h2,
.confirm-dialog__surface h2 {
    margin: 0;
    font-family: "Barlow", sans-serif;
    letter-spacing: -0.03em;
}

.timer-card h3 {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    color: var(--text);
}

.status-pill {
    min-height: auto;
    width: auto;
    padding: 0.55rem 0.85rem;
    font-size: 0.86rem;
    font-weight: 700;
    align-items: center;
}

.status-pill[data-state="running"] {
    color: var(--accent);
}

.status-pill[data-state="warning"] {
    color: var(--warning);
}

.status-pill[data-state="danger"],
.status-pill[data-state="finished"] {
    color: var(--danger);
}

.timer-ring {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 22rem;
}

.timer-ring__svg {
    width: min(100%, 380px);
}

.timer-ring__track,
.timer-ring__progress {
    fill: none;
    stroke-width: 8;
}

.timer-ring__track {
    stroke: var(--ring-track);
}

.timer-ring__progress {
    stroke: var(--brand);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 60px 60px;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke 140ms ease;
}

.timer-ring__content {
    position: absolute;
    display: grid;
    gap: 0.35rem;
    place-items: center;
    text-align: center;
}

.timer-ring__time {
    font-family: "Barlow", sans-serif;
    font-size: clamp(4rem, 10vw, 6.4rem);
    line-height: 0.9;
    letter-spacing: -0.06em;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
    min-width: 4.9ch;
    text-align: center;
    color: var(--text);
}

.timer-ring__hint {
    font-size: 1rem;
    color: var(--text-soft);
}

.timer-ring[data-urgency="normal"] .timer-ring__progress {
    stroke: var(--success);
}

.timer-ring[data-urgency="warning"] .timer-ring__progress {
    stroke: var(--warning);
}

.timer-ring[data-urgency="danger"] .timer-ring__progress {
    stroke: var(--danger);
}

.timer-ring.is-alerting {
    animation: last-minute-flash 1.15s ease-in-out infinite;
}

.timer-ring.is-alerting .timer-ring__progress {
    stroke: var(--danger);
}

.timer-ring.is-final-alert {
    animation: final-countdown-flash 0.65s ease-in-out infinite;
}

.timer-ring.is-final-alert .timer-ring__progress {
    stroke: var(--danger);
}

.timer-ring[data-urgency="finished"] {
    animation: pulse 1.8s ease-in-out infinite;
}

.timer-ring[data-urgency="finished"] .timer-ring__progress {
    stroke: var(--danger);
}

.center-control {
    display: grid;
    align-content: center;
    gap: 1rem;
    min-height: 32rem;
    padding: 1.4rem;
    text-align: center;
}

.preset-button,
.action-button,
.sync-button {
    border: 1px solid transparent;
    border-radius: 18px;
    font-weight: 700;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.preset-button {
    min-height: 3.5rem;
    padding: 0.9rem 1rem;
    color: var(--text);
    background: var(--surface-strong);
    border-color: var(--border);
}

.preset-button.is-active {
    color: white;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    box-shadow: 0 12px 26px rgba(241, 90, 36, 0.26);
}

.sync-button {
    min-height: 10rem;
    padding: 1.25rem 1.35rem;
    font-family: "Barlow", sans-serif;
    font-size: clamp(2.4rem, 4vw, 3.3rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: white;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    box-shadow: 0 18px 34px rgba(241, 90, 36, 0.3);
    text-wrap: balance;
}

.command-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.action-button {
    min-height: 3.5rem;
    padding: 0.9rem 1rem;
}

.action-button--secondary {
    color: var(--text);
    background: var(--surface-strong);
    border-color: var(--border);
}

.action-button--ghost {
    color: var(--text);
    background: transparent;
    border-color: var(--border);
}

.action-button--primary {
    color: white;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}

.action-button--full {
    width: 100%;
}

.preset-button:hover,
.action-button:hover,
.sync-button:hover,
.preset-button:focus-visible,
.action-button:focus-visible,
.sync-button:focus-visible,
.theme-toggle:focus-visible {
    transform: translateY(-1px);
}

.action-button:disabled,
.sync-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.eyebrow {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand);
}

.setup-dialog,
.confirm-dialog,
.settings-dialog {
    width: min(94vw, 760px);
    max-height: min(90vh, 920px);
    padding: 0;
    border: 0;
    background: transparent;
}

.setup-dialog::backdrop,
.confirm-dialog::backdrop,
.settings-dialog::backdrop {
    background: rgba(4, 8, 14, 0.52);
    backdrop-filter: blur(10px);
}

.setup-dialog__surface,
.confirm-dialog__surface,
.settings-dialog__surface {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 28px;
    background: var(--surface-strong);
    color: var(--text);
}

.settings-dialog__surface {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 1.1rem;
    max-height: min(90vh, 920px);
    overflow: hidden;
}

.confirm-dialog__surface .action-button,
.settings-dialog__surface .action-button,
.setup-dialog__surface .preset-button {
    color: var(--text);
}

.confirm-dialog__surface .action-button--primary,
.settings-dialog__surface .action-button--primary {
    color: white;
}

.setup-dialog__surface h2 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    text-align: center;
}

.setup-dialog__grid,
.confirm-dialog__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.preset-button--setup {
    min-height: 4rem;
    font-size: 1.05rem;
}

.settings-dialog__grid {
    display: grid;
    gap: 0.8rem;
}

.settings-dialog__header {
    display: grid;
    gap: 0.35rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.settings-dialog__header h2 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.settings-dialog__intro {
    margin: 0;
    color: var(--text-soft);
}

.settings-dialog__content {
    display: grid;
    gap: 1.15rem;
    min-height: 0;
    overflow: auto;
    padding-right: 0.35rem;
}

.settings-dialog__section,
.settings-dialog__audio {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-muted);
}

.settings-dialog__audio {
    gap: 1rem;
}

.settings-dialog__subheading {
    margin: 0;
    font-family: "Barlow", sans-serif;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.settings-dialog__audio-grid {
    display: grid;
    gap: 0.8rem;
}

.audio-admin {
    display: grid;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.audio-admin__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.audio-admin__hint {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-soft);
}

.audio-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.8rem;
    padding: 0.55rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease;
}

.audio-upload:hover,
.audio-upload:focus-within {
    transform: translateY(-1px);
}

.audio-library {
    display: grid;
    gap: 0.6rem;
    max-height: 18rem;
    overflow: auto;
    padding-right: 0.1rem;
}

.audio-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-muted);
}

.audio-item__meta {
    min-width: 0;
    display: grid;
    gap: 0.3rem;
}

.audio-item__name {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-item__tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.audio-tag {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-soft);
}

.audio-tag--custom {
    color: var(--brand);
}

.audio-item__actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.audio-action {
    min-height: 2.3rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--text);
    font-weight: 700;
}

.audio-action--danger {
    color: var(--danger);
}

.settings-field {
    display: grid;
    gap: 0.35rem;
}

.settings-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 3.4rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-muted);
    gap: 1rem;
}

.settings-toggle span {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
}

.settings-toggle input {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--brand);
}

.settings-field span {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
}

.settings-field input,
.settings-field select {
    min-height: 3.4rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    background: var(--surface-muted);
}

.settings-dialog__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
    background: var(--surface-strong);
    box-shadow: 0 -10px 24px rgba(6, 12, 22, 0.12);
}

.confirm-dialog__actions {
    grid-template-columns: 1fr 1fr;
}

.confirm-dialog__surface p {
    margin: 0;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.012);
        opacity: 0.72;
    }
}

@keyframes last-minute-flash {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.58;
        transform: scale(0.992);
    }
}

@keyframes final-countdown-flash {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(214, 69, 69, 0));
    }

    50% {
        opacity: 0.38;
        transform: scale(0.988);
        filter: drop-shadow(0 0 14px rgba(214, 69, 69, 0.34));
    }
}

@media (min-width: 1100px) {
    .arena-layout {
        grid-template-columns: minmax(0, 1fr) minmax(280px, 0.48fr) minmax(0, 1fr);
    }
}

@media (max-width: 1099px) {
    .arena-layout {
        grid-template-columns: 1fr;
    }

    .center-control {
        order: -1;
        min-height: auto;
    }

    .preset-grid,
    .command-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .command-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (orientation: landscape) and (max-width: 1180px) {
    .app-shell {
        width: min(100%, calc(100% - 0.8rem));
        padding: 0.35rem 0 0.6rem;
    }

    .topbar {
        display: grid;
        grid-template-columns: minmax(180px, 26vw) minmax(0, 1fr);
        align-items: center;
        gap: 0.75rem;
        padding: 0.7rem 0.85rem;
        border-radius: 22px;
    }

    .brand {
        min-width: 0;
    }

    .brand__logo {
        width: clamp(170px, 22vw, 280px);
    }

    .topbar__side {
        width: 100%;
        gap: 0.5rem;
    }

    .meta-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .meta-card,
    .status-pill,
    .theme-toggle,
    .icon-toggle {
        min-height: 3rem;
        padding: 0.55rem 0.7rem;
    }

    .topbar__tools {
        gap: 0.45rem;
    }

    .preset-strip {
        gap: 0.35rem;
    }

    .preset-strip .preset-button,
    .settings-button {
        min-height: 2.25rem;
        padding: 0.45rem 0.7rem;
        font-size: 0.82rem;
    }

    .layout {
        margin-top: 0.65rem;
    }

    .arena-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        align-items: stretch;
    }

    .center-control {
        order: -1;
        grid-column: 1 / -1;
        min-height: auto;
        padding: 0.8rem;
        grid-template-columns: minmax(200px, 1.2fr) minmax(0, 1fr);
        align-items: stretch;
        text-align: left;
    }

    .sync-button {
        min-height: 5.4rem;
        font-size: clamp(2rem, 4vw, 2.8rem);
    }

    .command-grid {
        grid-template-columns: 1fr 1fr;
        align-self: stretch;
    }

    .action-button {
        min-height: 2.9rem;
    }

    .timer-card,
    .center-control {
        border-radius: 24px;
    }

    .timer-card {
        min-height: 0;
        gap: 0.75rem;
        padding: 0.8rem;
    }

    .timer-card h3 {
        font-size: clamp(1.35rem, 2.6vw, 2rem);
    }

    .timer-ring {
        min-height: 11.5rem;
    }

    .timer-ring__svg {
        width: min(100%, 240px);
    }

    .timer-ring__time {
        font-size: clamp(2.8rem, 8vw, 4.5rem);
    }

    .timer-ring__hint {
        font-size: 0.88rem;
    }

    .status-pill {
        font-size: 0.78rem;
    }
}

@media (orientation: landscape) and (max-width: 920px) {
    .topbar {
        grid-template-columns: 150px minmax(0, 1fr);
        padding: 0.55rem 0.7rem;
    }

    .brand__logo {
        width: clamp(140px, 18vw, 210px);
    }

    .meta-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) 52px 52px;
    }

    .meta-card strong {
        font-size: 0.88rem;
    }

    .meta-card__label,
    .settings-field span,
    .settings-toggle span {
        font-size: 0.62rem;
    }

    .center-control {
        grid-template-columns: minmax(170px, 1.1fr) minmax(0, 1fr);
        gap: 0.6rem;
        padding: 0.7rem;
    }

    .sync-button {
        min-height: 4.9rem;
        font-size: clamp(1.7rem, 4.8vw, 2.35rem);
    }

    .timer-card__header,
    .timer-card__footer {
        gap: 0.55rem;
    }

    .timer-ring {
        min-height: 10rem;
    }

    .timer-ring__svg {
        width: min(100%, 205px);
    }

    .timer-ring__time {
        font-size: clamp(2.35rem, 7.2vw, 3.8rem);
    }
}

@media (orientation: landscape) and (max-width: 920px) and (max-height: 460px) {
    .app-shell {
        width: min(100%, calc(100% - 0.5rem));
        padding-top: 0.25rem;
    }

    .topbar {
        gap: 0.55rem;
        padding: 0.45rem 0.6rem;
    }

    .meta-card,
    .status-pill,
    .theme-toggle,
    .icon-toggle {
        min-height: 2.55rem;
        padding: 0.45rem 0.55rem;
    }

    .preset-strip .preset-button,
    .settings-button,
    .action-button {
        min-height: 2.4rem;
    }

    .center-control {
        padding: 0.6rem;
    }

    .sync-button {
        min-height: 4.4rem;
    }

    .timer-card {
        padding: 0.7rem;
    }

    .timer-ring {
        min-height: 8.8rem;
    }

    .timer-ring__svg {
        width: min(100%, 170px);
    }

    .timer-ring__time {
        font-size: clamp(2rem, 6.5vw, 3.2rem);
    }

    .timer-ring__hint {
        font-size: 0.8rem;
    }
}

@media (max-width: 760px) and (orientation: portrait) {
    .topbar {
        flex-direction: column;
    }

    .topbar__side {
        width: 100%;
    }

    .meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .theme-toggle,
    .icon-toggle {
        grid-column: 1 / -1;
    }

    .meta-card--accent {
        grid-column: span 1;
    }

    .preset-strip,
    .setup-dialog__grid,
    .confirm-dialog__actions,
    .settings-dialog__actions,
    .command-grid {
        grid-template-columns: 1fr;
    }

    .topbar__tools {
        flex-direction: column;
        align-items: stretch;
    }

    .preset-strip {
        justify-content: flex-start;
    }

    .timer-card,
    .center-control,
    .topbar {
        border-radius: 24px;
    }

    .timer-card {
        min-height: auto;
    }

    .timer-ring {
        min-height: 16rem;
    }

    .timer-card__header,
    .timer-card__footer {
        flex-direction: column;
        align-items: stretch;
    }
}
