/* CubeCoach 2.0 — Prism glass design system */

:root {
    color-scheme: dark;
    --bg: #070811;
    --bg-deep: #05060d;
    --surface: rgba(17, 19, 33, 0.72);
    --surface-strong: rgba(21, 23, 39, 0.9);
    --surface-soft: rgba(255, 255, 255, 0.035);
    --surface-hover: rgba(255, 255, 255, 0.065);
    --input: rgba(7, 9, 18, 0.62);
    --border: rgba(255, 255, 255, 0.085);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text: #f5f6ff;
    --text-soft: #c9ccdc;
    --text-muted: #8b91aa;
    --text-faint: #5d647d;
    --violet: #8b7cff;
    --violet-bright: #a99cff;
    --violet-soft: rgba(139, 124, 255, 0.13);
    --cyan: #55d9f5;
    --cyan-soft: rgba(85, 217, 245, 0.12);
    --mint: #8ef3d0;
    --mint-strong: #4cddb0;
    --mint-soft: rgba(142, 243, 208, 0.12);
    --amber: #f7c875;
    --amber-soft: rgba(247, 200, 117, 0.12);
    --danger: #ff7e9d;
    --danger-soft: rgba(255, 126, 157, 0.12);
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
    --shadow-violet: 0 22px 60px rgba(82, 63, 197, 0.2);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --sidebar-w: 252px;
    --font: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

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

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html {
    overflow: hidden;
}

body {
    overflow: hidden;
}

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

button,
a,
label,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

button:not(:disabled),
select:not(:disabled),
label:has(input:not(:disabled)) {
    cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
    cursor: not-allowed;
    opacity: .46;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg {
    display: block;
}

h1,
h2,
h3,
p {
    margin: 0;
}

::selection {
    background: rgba(139, 124, 255, .35);
    color: #fff;
}

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .24);
    background-clip: padding-box;
}

:focus-visible {
    outline: 2px solid var(--violet-bright);
    outline-offset: 3px;
}

h1[tabindex="-1"]:focus {
    outline: none;
}

.valid.modified:not([type="checkbox"]) {
    outline: 2px solid var(--mint);
}

.invalid {
    outline: 2px solid var(--danger);
}

.validation-message {
    color: var(--danger);
    font-size: .82rem;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 50%;
    z-index: 10000;
    padding: 10px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--text);
    transform: translate(-50%, -150%);
    transition: transform .2s var(--ease);
}

.skip-link:focus {
    transform: translate(-50%, 0);
}

.app-icon {
    flex: 0 0 auto;
}

/* App shell */

.app-shell {
    position: relative;
    isolation: isolate;
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    gap: 14px;
    padding: 14px;
    overflow: hidden;
    background:
        radial-gradient(circle at 72% -10%, rgba(121, 91, 255, .16), transparent 35%),
        radial-gradient(circle at 115% 82%, rgba(57, 205, 226, .11), transparent 32%),
        linear-gradient(145deg, #090a14 0%, #070811 55%, #080912 100%);
}

.app-shell::before {
    position: absolute;
    inset: 0;
    z-index: -3;
    opacity: .23;
    background-image:
        linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, #000, transparent 85%);
    content: "";
}

.app-ambient {
    position: absolute;
    z-index: -2;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}

.app-ambient-one {
    top: -180px;
    left: 25%;
    width: 440px;
    height: 440px;
    background: rgba(105, 76, 235, .12);
}

.app-ambient-two {
    right: -160px;
    bottom: -180px;
    width: 460px;
    height: 460px;
    background: rgba(56, 203, 218, .075);
}

.main-content {
    position: relative;
    min-width: 0;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.main-content:focus {
    outline: none;
}

.glass-panel {
    border: 1px solid var(--border);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .012) 42%),
        var(--surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), var(--shadow-sm);
    backdrop-filter: blur(24px) saturate(130%);
    -webkit-backdrop-filter: blur(24px) saturate(130%);
}

/* Sidebar */

.sidebar {
    position: relative;
    z-index: 100;
    display: flex;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100%;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 22%),
        rgba(13, 15, 27, .78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .055), 0 24px 70px rgba(0, 0, 0, .28);
    backdrop-filter: blur(28px) saturate(140%);
    -webkit-backdrop-filter: blur(28px) saturate(140%);
}

.sidebar::after {
    position: absolute;
    top: -70px;
    right: -65px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(139, 124, 255, .12);
    filter: blur(35px);
    content: "";
    pointer-events: none;
}

.sidebar-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 21px 20px 18px;
}

.app-logo,
.mobile-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.app-logo-mark {
    width: 39px;
    height: 39px;
    flex: 0 0 auto;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(101, 80, 225, .28);
}

.app-logo-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.app-logo-title {
    display: flex;
    align-items: center;
    gap: 7px;
}

.app-logo-name {
    font-size: 1.01rem;
    font-weight: 750;
    letter-spacing: -.035em;
}

.version-pill,
.nav-beta {
    border: 1px solid rgba(139, 124, 255, .28);
    border-radius: 999px;
    background: var(--violet-soft);
    color: #c8c0ff;
    font-size: .59rem;
    font-weight: 750;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.version-pill {
    padding: 4px 6px;
}

.app-logo-tagline {
    overflow: hidden;
    color: var(--text-faint);
    font-size: .69rem;
    font-weight: 650;
    letter-spacing: .055em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-nav {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 12px;
}

.sidebar-section-label {
    padding: 10px 11px 8px;
    color: var(--text-faint);
    font-size: .66rem;
    font-weight: 750;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.sidebar-section-spaced {
    margin-top: 13px;
}

.nav-item {
    position: relative;
    display: flex;
    min-height: 59px;
    align-items: center;
    gap: 11px;
    margin: 2px 0;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 15px;
    color: var(--text-muted);
    transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s var(--ease);
}

.nav-item:hover {
    border-color: rgba(255, 255, 255, .055);
    background: rgba(255, 255, 255, .035);
    color: var(--text-soft);
    transform: translateX(2px);
}

.nav-item.active {
    border-color: rgba(139, 124, 255, .16);
    background:
        linear-gradient(100deg, rgba(139, 124, 255, .17), rgba(139, 124, 255, .065));
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.nav-item.active::before {
    position: absolute;
    left: -13px;
    width: 3px;
    height: 25px;
    border-radius: 0 6px 6px 0;
    background: linear-gradient(var(--violet-bright), var(--cyan));
    box-shadow: 0 0 18px rgba(139, 124, 255, .65);
    content: "";
}

.nav-item-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .05);
    border-radius: 12px;
    background: rgba(255, 255, 255, .035);
    color: var(--text-faint);
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.nav-item.active .nav-item-icon {
    border-color: rgba(139, 124, 255, .22);
    background: rgba(139, 124, 255, .13);
    color: #b9afff;
}

.nav-item-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 1px;
}

.nav-item-name-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.nav-item-name {
    overflow: hidden;
    font-size: .87rem;
    font-weight: 680;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item-hint {
    overflow: hidden;
    color: var(--text-faint);
    font-size: .69rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-beta {
    padding: 3px 5px;
}

.sidebar-footer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 12px;
}

.sidebar-local-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(142, 243, 208, .09);
    border-radius: 15px;
    background: rgba(142, 243, 208, .035);
}

.local-note-icon {
    display: grid;
    width: 31px;
    height: 31px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    background: var(--mint-soft);
    color: var(--mint);
}

.sidebar-local-note > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.sidebar-local-note strong {
    color: var(--text-soft);
    font-size: .72rem;
    font-weight: 650;
}

.sidebar-local-note small {
    overflow: hidden;
    color: var(--text-faint);
    font-size: .63rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-action {
    display: flex;
    height: 44px;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-radius: 13px;
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 630;
    transition: color .2s ease, background .2s ease;
}

.sidebar-action:hover,
.sidebar-action.active {
    background: rgba(255, 255, 255, .04);
    color: var(--text);
}

.sidebar-action-chevron {
    margin-left: auto;
}

.sidebar-close {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
}

.mobile-only,
.mobile-topbar {
    display: none;
}

.mobile-bottom-nav {
    display: none;
}

.mobile-local-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-faint);
    font-size: .68rem;
    font-weight: 650;
}

.mobile-local-status > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 10px rgba(142, 243, 208, .48);
}

/* Shared page and controls */

.page-container {
    width: min(100%, 1450px);
    margin: 0 auto;
    padding: 18px 18px 60px;
}

.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    padding: 20px 4px 27px;
}

.page-hero > div:first-child {
    max-width: 730px;
}

.page-hero h1 {
    margin-top: 9px;
    font-size: clamp(2.15rem, 4vw, 3.5rem);
    font-weight: 730;
    letter-spacing: -.06em;
    line-height: 1.02;
}

.page-hero p {
    max-width: 680px;
    margin-top: 11px;
    color: var(--text-muted);
    font-size: .97rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #aaa2e9;
    font-size: .66rem;
    font-weight: 760;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.btn-primary,
.btn-secondary,
.btn-danger,
.icon-button,
.text-button,
.log-action,
.btn-icon-round,
.btn-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 13px;
    font-weight: 660;
    transition: transform .2s var(--ease), border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    min-height: 44px;
    padding: 0 16px;
    font-size: .82rem;
}

.btn-primary {
    border-color: rgba(168, 154, 255, .32);
    background: linear-gradient(135deg, #8b7cff, #6d5ce8);
    color: #fff;
    box-shadow: 0 12px 28px rgba(91, 70, 210, .23), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 16px 35px rgba(91, 70, 210, .34), inset 0 1px 0 rgba(255, 255, 255, .26);
    transform: translateY(-2px);
}

.btn-secondary {
    border-color: var(--border);
    background: var(--surface-soft);
    color: var(--text-soft);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text);
    transform: translateY(-1px);
}

.btn-danger {
    border-color: rgba(255, 126, 157, .18);
    background: var(--danger-soft);
    color: #ff9db5;
}

.btn-danger:hover:not(:disabled) {
    border-color: rgba(255, 126, 157, .34);
    background: rgba(255, 126, 157, .18);
}

.btn-compact {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 11px;
    font-size: .75rem;
}

.icon-button {
    width: 39px;
    height: 39px;
    flex: 0 0 auto;
    border-color: var(--border);
    background: rgba(255, 255, 255, .035);
    color: var(--text-muted);
}

.icon-button:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, .07);
    color: var(--text);
    transform: translateY(-1px);
}

.icon-button.subtle {
    border-color: transparent;
    background: rgba(255, 255, 255, .03);
}

.text-button {
    min-height: 34px;
    padding: 0 10px;
    border-color: transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: .72rem;
}

.text-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, .045);
    color: var(--text);
}

.content-loading {
    display: flex;
    min-height: 280px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: .88rem;
}

.loading-spinner {
    width: 19px;
    height: 19px;
    border: 2px solid rgba(255, 255, 255, .12);
    border-top-color: var(--violet-bright);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

.loading-spinner.small {
    width: 17px;
    height: 17px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes float-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Timer */

.timer-page {
    display: flex;
    width: min(100%, 1510px);
    min-height: 100%;
    flex-direction: column;
    gap: 14px;
    margin: 0 auto;
    padding: 4px 4px 50px;
}

.timer-command-bar {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 12px 10px 16px;
    border-radius: 19px;
}

.timer-session-control,
.timer-top-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.command-icon {
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    border-radius: 10px;
    background: var(--violet-soft);
    color: #b5acff;
}

.timer-session-control label {
    color: var(--text-faint);
    font-size: .65rem;
    font-weight: 750;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.timer-session-control select {
    min-width: 180px;
    max-width: 300px;
    height: 39px;
    padding: 0 36px 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--input);
    color: var(--text-soft);
    font-size: .79rem;
    font-weight: 620;
}

.timer-session-control select:focus {
    border-color: rgba(139, 124, 255, .52);
}

.timer-event-control {
    display: inline-flex;
    height: 34px;
    align-items: center;
    gap: 7px;
    padding: 0 7px 0 11px;
    border: 1px solid rgba(142, 243, 208, .12);
    border-radius: 999px;
    background: rgba(142, 243, 208, .045);
    color: var(--text-soft);
    font-size: .71rem;
    font-weight: 670;
}

.timer-event-select {
    width: 56px;
    height: 30px;
    padding: 0 18px 0 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-soft);
    font-size: .71rem;
    font-weight: 700;
}

.timer-event-select:focus-visible {
    outline: 2px solid var(--violet-bright);
    outline-offset: 1px;
    border-radius: 7px;
}

.timer-event-dot,
.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--text-faint);
}

.timer-event-dot,
.status-dot.connected {
    background: var(--mint);
    box-shadow: 0 0 12px rgba(142, 243, 208, .65);
}

.scramble-card {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    min-height: 97px;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
}

.scramble-card.has-diagram {
    grid-template-columns: 160px minmax(0, 1fr) 210px;
}

.scramble-heading {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    justify-content: space-between;
    padding-right: 18px;
    border-right: 1px solid var(--border);
}

.scramble-number {
    color: var(--mint);
}

.scramble-actions {
    display: flex;
    align-items: center;
    margin-left: -8px;
}

.scramble-text {
    padding: 6px 12px;
    color: #f0f2fb;
    font-family: var(--mono);
    font-size: clamp(.88rem, 1.35vw, 1.05rem);
    font-weight: 650;
    letter-spacing: .025em;
    line-height: 1.7;
    text-align: center;
    transition: opacity .2s ease;
}

.scramble-sequence {
    min-width: 0;
}

.scramble-quality {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 6px;
    margin: 2px auto 0;
    color: var(--text-faint);
    font-size: .57rem;
    font-weight: 680;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.scramble-quality > span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-faint);
}

.scramble-quality.random-state > span {
    background: var(--mint);
    box-shadow: 0 0 10px rgba(142, 243, 208, .58);
}

.scramble-diagram {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    padding-left: 18px;
    border-left: 1px solid var(--border);
}

.scramble-diagram-loading {
    color: var(--text-faint);
    font-size: .62rem;
}

.scramble-net {
    display: grid;
    grid-template-columns: repeat(4, 42px);
    grid-template-rows: repeat(3, 42px);
    gap: 3px;
}

.scramble-net-face {
    position: relative;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 6px;
    background: rgba(7, 8, 14, .72);
}

.scramble-net-stickers {
    display: grid;
    height: 100%;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
}

.scramble-net.size-2 .scramble-net-stickers {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.scramble-net-label {
    position: absolute;
    top: 2px;
    left: 3px;
    z-index: 1;
    color: rgba(5, 6, 10, .68);
    font-family: var(--mono);
    font-size: .42rem;
    font-weight: 900;
    pointer-events: none;
}

.scramble-net-face.face-up { grid-area: 1 / 2; }
.scramble-net-face.face-left { grid-area: 2 / 1; }
.scramble-net-face.face-front { grid-area: 2 / 2; }
.scramble-net-face.face-right { grid-area: 2 / 3; }
.scramble-net-face.face-back { grid-area: 2 / 4; }
.scramble-net-face.face-down { grid-area: 3 / 2; }

.scramble-diagram figcaption {
    margin-top: 6px;
    color: var(--text-faint);
    font-size: .5rem;
    line-height: 1.25;
    text-align: center;
}

.scramble-text.is-loading {
    color: var(--text-faint);
    animation: breathe 1.4s ease-in-out infinite;
}

.scramble-text.long {
    font-size: clamp(.78rem, 1.05vw, .92rem);
    line-height: 1.62;
}

.scramble-text.very-long {
    font-size: clamp(.72rem, .9vw, .84rem);
    line-height: 1.55;
}

@keyframes breathe {
    50% { opacity: .48; }
}

.timer-workspace {
    display: grid;
    min-height: 500px;
    grid-template-columns: minmax(0, 1.55fr) minmax(340px, .8fr);
    gap: 14px;
}

.timer-stage {
    position: relative;
    isolation: isolate;
    display: flex;
    min-width: 0;
    min-height: 500px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius-xl);
    touch-action: none;
    user-select: none;
    transition: border-color .3s ease, background .3s ease, box-shadow .3s ease, transform .15s ease;
}

.timer-stage::after {
    position: absolute;
    right: 22px;
    bottom: 18px;
    color: rgba(255, 255, 255, .13);
    font-family: var(--mono);
    font-size: .6rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    content: "Precision mode";
}

.timer-stage-glow {
    position: absolute;
    z-index: -2;
    top: 50%;
    left: 50%;
    width: 58%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(119, 96, 245, .13), rgba(119, 96, 245, .03) 45%, transparent 70%);
    filter: blur(16px);
    opacity: .8;
    transform: translate(-50%, -50%);
    transition: background .35s ease, opacity .35s ease, transform .35s ease;
}

.timer-stage-ring {
    position: absolute;
    z-index: -1;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(139, 124, 255, .08);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.timer-stage-ring-one {
    width: 330px;
    height: 330px;
}

.timer-stage-ring-two {
    width: 450px;
    height: 450px;
    border-color: rgba(85, 217, 245, .035);
}

.timer-stage.holding {
    border-color: rgba(247, 200, 117, .22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 24px 70px rgba(0, 0, 0, .28), inset 0 0 70px rgba(247, 200, 117, .025);
}

.timer-stage.ready {
    border-color: rgba(142, 243, 208, .32);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 24px 75px rgba(0, 0, 0, .3), inset 0 0 90px rgba(142, 243, 208, .06);
}

.timer-stage.ready .timer-stage-glow {
    background: radial-gradient(circle, rgba(92, 230, 183, .21), rgba(92, 230, 183, .03) 50%, transparent 70%);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
}

.timer-stage.inspecting .timer-stage-glow {
    background: radial-gradient(circle, rgba(85, 217, 245, .18), transparent 67%);
}

.timer-stage.running {
    border-color: rgba(255, 255, 255, .11);
    background: rgba(8, 10, 18, .88);
}

.timer-stage.running .timer-stage-glow,
.timer-stage.running .timer-stage-ring {
    opacity: .25;
}

.timer-mode-chip {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid rgba(139, 124, 255, .14);
    border-radius: 999px;
    background: rgba(139, 124, 255, .065);
    color: #bcb5e7;
    font-size: .65rem;
    font-weight: 750;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.timer-mode-chip > span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--violet-bright);
    box-shadow: 0 0 10px rgba(139, 124, 255, .65);
}

.timer-mode-chip.holding {
    border-color: rgba(247, 200, 117, .14);
    background: var(--amber-soft);
    color: var(--amber);
}

.timer-mode-chip.holding > span {
    background: var(--amber);
    box-shadow: 0 0 10px rgba(247, 200, 117, .55);
}

.timer-mode-chip.ready {
    border-color: rgba(142, 243, 208, .2);
    background: var(--mint-soft);
    color: var(--mint);
}

.timer-mode-chip.ready > span {
    background: var(--mint);
    box-shadow: 0 0 12px rgba(142, 243, 208, .7);
}

.timer-mode-chip.inspecting {
    border-color: rgba(85, 217, 245, .17);
    background: var(--cyan-soft);
    color: var(--cyan);
}

.timer-mode-chip.inspecting > span {
    background: var(--cyan);
}

.timer-display {
    position: relative;
    margin: 24px 0 10px;
    color: #f8f9ff;
    font-family: var(--mono);
    font-size: clamp(5.5rem, 10vw, 9.7rem);
    font-variant-numeric: tabular-nums;
    font-weight: 630;
    letter-spacing: -.085em;
    line-height: .88;
    text-shadow: 0 14px 55px rgba(190, 184, 255, .11);
    transition: color .2s ease, text-shadow .25s ease, transform .2s var(--ease);
}

.timer-display.holding {
    color: var(--amber);
    transform: scale(.985);
}

.timer-display.ready {
    color: var(--mint);
    text-shadow: 0 10px 55px rgba(142, 243, 208, .25);
    transform: scale(1.015);
}

.timer-display.inspecting {
    color: #b9edf8;
}

.timer-display.running {
    color: #d9dbea;
}

.timer-instruction {
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 580;
    text-align: center;
}

.timer-shortcut-hint {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 24px;
    color: var(--text-faint);
    font-size: .65rem;
}

kbd {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    padding: 0 8px;
    border: 1px solid var(--border-strong);
    border-bottom-color: rgba(255, 255, 255, .22);
    border-radius: 7px;
    background: rgba(255, 255, 255, .055);
    color: var(--text-soft);
    font-family: var(--font);
    font-size: .63rem;
    font-weight: 680;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .28);
}

.shortcut-divider {
    color: rgba(255, 255, 255, .15);
}

.timer-quick-penalties {
    position: absolute;
    bottom: 24px;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(7, 9, 17, .68);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
    transform: translateX(-50%);
}

.timer-quick-penalties > span {
    padding: 0 7px;
    color: var(--text-faint);
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.quick-penalty-button {
    height: 29px;
    min-width: 36px;
    padding: 0 9px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: .67rem;
    font-weight: 750;
}

.quick-penalty-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.quick-penalty-button.active {
    background: var(--violet-soft);
    color: #bfb7ff;
}

.quick-penalty-button.danger {
    color: #d98ba0;
}

.timer-stats-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 22px;
    border-radius: var(--radius-xl);
}

.timer-panel-heading,
.timer-trend-heading,
.solve-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.timer-panel-heading h2 {
    margin-top: 5px;
    font-size: 1.18rem;
    font-weight: 690;
    letter-spacing: -.035em;
}

.solve-count {
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: .64rem;
    font-weight: 650;
}

.timer-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 19px;
}

.timer-stat-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 111px;
    flex-direction: column;
    justify-content: center;
    padding: 15px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 16px;
    background: rgba(255, 255, 255, .022);
}

.timer-stat-card.featured::after {
    position: absolute;
    top: -28px;
    right: -28px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(139, 124, 255, .09);
    filter: blur(14px);
    content: "";
}

.timer-stat-card > span {
    color: var(--text-muted);
    font-size: .65rem;
    font-weight: 620;
}

.timer-stat-card strong {
    overflow: hidden;
    margin: 4px 0 5px;
    color: #eff1fa;
    font-family: var(--mono);
    font-size: 1.32rem;
    font-variant-numeric: tabular-nums;
    font-weight: 620;
    letter-spacing: -.045em;
    text-overflow: ellipsis;
}

.timer-stat-card small {
    color: var(--text-faint);
    font-size: .61rem;
}

.timer-stat-card small b {
    color: #8e94ab;
    font-weight: 600;
}

.timer-trend {
    min-height: 152px;
    flex: 1;
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.timer-trend-heading span {
    color: var(--text-soft);
    font-size: .7rem;
    font-weight: 650;
}

.timer-trend-heading small {
    color: var(--text-faint);
    font-size: .59rem;
}

.timer-trend svg {
    width: 100%;
    height: 116px;
    margin-top: 7px;
    overflow: visible;
}

.trend-line {
    fill: none;
    stroke: var(--mint);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 5px rgba(142, 243, 208, .22));
}

.trend-area {
    fill: url("#trend-fill");
}

.timer-trend-empty {
    display: flex;
    height: 105px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 11px;
    color: var(--text-faint);
    font-size: .68rem;
    text-align: center;
}

.trend-placeholder-line {
    width: 70%;
    height: 35px;
    opacity: .5;
    border-top: 1px dashed rgba(255, 255, 255, .1);
    border-radius: 50%;
    transform: rotate(-4deg);
}

.solve-log {
    min-height: 240px;
    padding: 22px;
    border-radius: var(--radius-xl);
}

.solve-log-header {
    align-items: flex-end;
    padding-bottom: 18px;
}

.solve-log-title {
    display: flex;
    min-width: 180px;
    flex-direction: column;
    gap: 5px;
}

.session-name-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-faint);
}

.session-name-input {
    width: min(280px, 100%);
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 680;
    letter-spacing: -.025em;
}

.session-name-input:focus {
    color: #fff;
}

.solve-log-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
}

.compact-toggle {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 7px;
    padding: 0 9px;
    color: var(--text-muted);
    font-size: .67rem;
    font-weight: 650;
}

.compact-toggle > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-track {
    position: relative;
    width: 29px;
    height: 17px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    transition: background .2s ease;
}

.toggle-track > span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform .2s var(--ease), background .2s ease;
}

.compact-toggle input:checked + .toggle-track {
    background: rgba(142, 243, 208, .22);
}

.compact-toggle input:checked + .toggle-track > span {
    background: var(--mint);
    box-shadow: 0 0 8px rgba(142, 243, 208, .4);
    transform: translateX(12px);
}

.log-action {
    min-height: 34px;
    padding: 0 10px;
    border-color: var(--border);
    background: rgba(255, 255, 255, .025);
    color: var(--text-muted);
    font-size: .65rem;
}

.log-action:hover:not(:disabled),
.import-action:hover:not(.disabled) {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text);
}

.log-action.danger {
    border-color: rgba(255, 126, 157, .09);
    color: #c98194;
}

.import-action {
    position: relative;
    user-select: none;
}

.import-action.disabled {
    cursor: not-allowed;
    opacity: .46;
}

.import-action input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.timer-data-message,
.settings-message,
.chat-notice,
.error-msg {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 13px;
    border: 1px solid rgba(85, 217, 245, .13);
    border-radius: 12px;
    background: var(--cyan-soft);
    color: #b6dfe9;
    font-size: .75rem;
}

.timer-data-message {
    margin-bottom: 13px;
}

.solve-table-wrap {
    overflow-x: auto;
    border-top: 1px solid var(--border);
}

.solve-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.solve-table th {
    padding: 13px 10px;
    color: var(--text-faint);
    font-size: .59rem;
    font-weight: 740;
    letter-spacing: .1em;
    text-align: left;
    text-transform: uppercase;
}

.solve-table td {
    height: 55px;
    padding: 8px 10px;
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, .038);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: .69rem;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.solve-table tbody tr {
    transition: background .18s ease;
}

.solve-table tbody tr:hover {
    background: rgba(255, 255, 255, .021);
}

.solve-table th:nth-child(1) { width: 58px; }
.solve-table th:nth-child(2) { width: 100px; }
.solve-table th:nth-child(3),
.solve-table th:nth-child(4) { width: 78px; }
.solve-table th:nth-child(6) { width: 118px; }
.solve-table th:nth-child(7) { width: 45px; }

.solve-number {
    color: var(--text-faint);
}

.solve-time-button {
    padding: 5px 7px;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    font-family: var(--mono);
    font-size: .78rem;
    font-weight: 650;
}

.solve-time-button:hover:not(:disabled) {
    background: var(--violet-soft);
    color: #c5beff;
}

.solve-time-button.plus-two {
    color: var(--amber);
}

.solve-time-button.dnf {
    color: var(--danger);
    text-decoration: line-through;
}

.solve-scramble {
    display: block;
    overflow: hidden;
    color: #8f95ab;
    font: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-delete {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 9px;
    background: transparent;
    color: var(--text-faint);
}

.row-delete:hover:not(:disabled) {
    background: var(--danger-soft);
    color: var(--danger);
}

.solve-empty {
    display: flex;
    min-height: 230px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.solve-empty-visual {
    position: relative;
    margin-bottom: 14px;
}

.solve-empty-icon {
    position: relative;
    z-index: 1;
    color: #454b61;
    font-family: var(--mono);
    font-size: 1.9rem;
    font-weight: 620;
    letter-spacing: -.06em;
}

.solve-empty-glow {
    position: absolute;
    inset: -10px -28px;
    border-radius: 50%;
    background: rgba(139, 124, 255, .1);
    filter: blur(20px);
}

.solve-empty h3 {
    font-size: .91rem;
    font-weight: 660;
}

.solve-empty p {
    max-width: 560px;
    margin-top: 7px;
    color: var(--text-faint);
    font-size: .7rem;
}

.timer-toast,
.alg-toast {
    position: fixed;
    z-index: 1000;
    right: 28px;
    bottom: 27px;
    display: flex;
    min-height: 45px;
    align-items: center;
    gap: 9px;
    padding: 0 15px;
    border: 1px solid rgba(142, 243, 208, .17);
    border-radius: 14px;
    background: rgba(17, 26, 28, .9);
    box-shadow: var(--shadow);
    color: #bff6e3;
    font-size: .76rem;
    font-weight: 620;
    backdrop-filter: blur(18px);
    animation: float-in .25s var(--ease);
}

/* Settings */

.settings-page {
    max-width: 1220px;
}

.settings-message {
    margin-bottom: 14px;
    border-color: rgba(142, 243, 208, .14);
    background: var(--mint-soft);
    color: #bcebdc;
}

.settings-message.error,
.error-msg {
    border-color: rgba(255, 126, 157, .16);
    background: var(--danger-soft);
    color: #f1a9ba;
}

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

.settings-section {
    min-width: 0;
    padding: 23px;
    border-radius: var(--radius-lg);
}

.settings-wide {
    grid-column: 1 / -1;
}

.settings-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.settings-section-heading > div {
    min-width: 0;
}

.settings-section-heading h2 {
    margin-top: 3px;
    font-size: 1.08rem;
    font-weight: 680;
    letter-spacing: -.035em;
}

.settings-section-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 13px;
}

.settings-section-icon.violet { background: var(--violet-soft); color: #b9afff; }
.settings-section-icon.cyan { background: var(--cyan-soft); color: var(--cyan); }
.settings-section-icon.mint { background: var(--mint-soft); color: var(--mint); }
.settings-section-icon.amber { background: var(--amber-soft); color: var(--amber); }

.setting-row {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 0;
    border-top: 1px solid var(--border);
}

.setting-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.setting-copy strong {
    color: var(--text-soft);
    font-size: .8rem;
    font-weight: 640;
}

.setting-copy small {
    color: var(--text-faint);
    font-size: .69rem;
}

.switch-control {
    position: relative;
    width: 43px;
    height: 25px;
    flex: 0 0 auto;
}

.switch-control input {
    position: absolute;
    opacity: 0;
}

.switch-control > span {
    position: absolute;
    inset: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, .055);
    transition: background .2s ease, border-color .2s ease;
}

.switch-control i {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
    transition: transform .22s var(--ease), background .2s ease;
}

.switch-control input:checked + span {
    border-color: rgba(139, 124, 255, .25);
    background: rgba(139, 124, 255, .3);
}

.switch-control input:checked + span i {
    background: #c7c0ff;
    transform: translateX(18px);
}

.setting-field select,
.input-field {
    min-height: 43px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: 0;
    background: var(--input);
    color: var(--text-soft);
}

.setting-field select {
    min-width: 118px;
    padding: 0 33px 0 11px;
    font-size: .74rem;
}

.setting-field select:focus,
.input-field:focus {
    border-color: rgba(139, 124, 255, .52);
    box-shadow: 0 0 0 3px rgba(139, 124, 255, .09);
}

.data-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-top: 4px;
}

.data-summary > div {
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 14px;
    background: rgba(255, 255, 255, .024);
}

.data-summary strong {
    color: var(--text);
    font-family: var(--mono);
    font-size: 1.18rem;
    font-weight: 620;
    letter-spacing: -.045em;
}

.data-summary span {
    color: var(--text-faint);
    font-size: .63rem;
}

.settings-hint {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: .74rem;
    line-height: 1.65;
}

.settings-actions,
.connection-actions,
.about-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 17px;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-faint);
    font-size: .66rem;
    font-weight: 630;
}

.connection-status.connected {
    border-color: rgba(142, 243, 208, .13);
    background: var(--mint-soft);
    color: #aee4d4;
}

.connection-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.connection-content h3 {
    color: var(--text-soft);
    font-size: .86rem;
    font-weight: 650;
}

.connection-content p {
    max-width: 720px;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: .73rem;
}

.privacy-note {
    display: flex;
    max-width: 780px;
    align-items: flex-start;
    gap: 9px;
    margin-top: 13px;
    padding: 11px 12px;
    border: 1px solid rgba(247, 200, 117, .1);
    border-radius: 11px;
    background: var(--amber-soft);
    color: #c6af85;
    font-size: .67rem;
}

.privacy-note .app-icon {
    margin-top: 1px;
}

.connection-actions {
    min-width: max-content;
    justify-content: flex-end;
    margin-top: 0;
}

.about-section .settings-section-heading {
    margin-bottom: 0;
}

.about-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 620;
}

.about-link:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text);
}

.about-link .app-icon:last-child {
    margin-left: 4px;
}

/* Coach hub */

.coach-page {
    max-width: 1260px;
}

.coach-hero {
    align-items: center;
}

.coach-privacy-banner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(247, 200, 117, .1);
    border-radius: 16px;
    background: rgba(247, 200, 117, .045);
}

.coach-privacy-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 11px;
    background: var(--amber-soft);
    color: var(--amber);
}

.coach-privacy-banner strong {
    color: #d5c7ab;
    font-size: .76rem;
    font-weight: 650;
}

.coach-privacy-banner p {
    margin-top: 2px;
    color: #837c72;
    font-size: .66rem;
}

.coach-privacy-banner > a {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #b8a886;
    font-size: .68rem;
    font-weight: 630;
}

.coach-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.coach-status-row > div {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-faint);
    font-size: .67rem;
}

.coach-practice-overview {
    margin-bottom: 22px;
    padding: 21px;
    border-radius: var(--radius-lg);
}

.coach-practice-heading,
.coach-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.coach-practice-heading h2,
.coach-section-heading h2 {
    margin-top: 5px;
    font-size: 1.08rem;
    font-weight: 690;
    letter-spacing: -.035em;
}

.coach-local-badge {
    display: inline-flex;
    min-height: 29px;
    align-items: center;
    gap: 6px;
    padding: 0 9px;
    border: 1px solid rgba(142, 243, 208, .12);
    border-radius: 999px;
    background: var(--mint-soft);
    color: #9edfc9;
    font-size: .59rem;
    font-weight: 680;
    white-space: nowrap;
}

.coach-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 17px;
}

.coach-metric-grid > div {
    display: flex;
    min-height: 75px;
    justify-content: center;
    flex-direction: column;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(255, 255, 255, .022);
}

.coach-metric-grid strong {
    overflow: hidden;
    font-family: var(--mono);
    font-size: 1.08rem;
    font-variant-numeric: tabular-nums;
    font-weight: 620;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coach-metric-grid span {
    margin-top: 3px;
    color: var(--text-faint);
    font-size: .58rem;
}

.coach-evidence-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.coach-evidence-grid > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .018);
}

.coach-evidence-grid span {
    color: var(--text-faint);
    font-size: .55rem;
    font-weight: 720;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.coach-evidence-grid strong {
    overflow: hidden;
    color: var(--text-muted);
    font-size: .63rem;
    font-weight: 620;
    line-height: 1.35;
    text-overflow: ellipsis;
}

.coach-local-focus {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: baseline;
    gap: 10px;
    margin-top: 10px;
    padding: 11px 12px;
    border: 1px solid rgba(85, 217, 245, .08);
    border-radius: 13px;
    background: rgba(85, 217, 245, .035);
}

.coach-local-focus > span {
    color: var(--text-faint);
    font-size: .55rem;
    font-weight: 740;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.coach-local-focus strong {
    color: #b9dce3;
    font-size: .69rem;
}

.coach-local-focus p {
    color: var(--text-muted);
    font-size: .66rem;
}

.coach-workflow-section {
    margin-bottom: 25px;
}

.coach-section-heading {
    align-items: flex-end;
    padding: 0 4px 11px;
}

.coach-section-heading > p {
    max-width: 430px;
    color: var(--text-faint);
    font-size: .65rem;
    text-align: right;
}

.coach-workflow-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.coach-workflow-card {
    display: grid;
    min-height: 132px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 17px;
    transition: border-color .2s ease, transform .2s var(--ease);
}

.coach-workflow-card:hover {
    border-color: rgba(139, 124, 255, .2);
    transform: translateY(-2px);
}

.coach-workflow-icon {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    border-radius: 13px;
}

.coach-workflow-icon.violet {
    background: var(--violet-soft);
    color: #afa6ff;
}

.coach-workflow-icon.cyan {
    background: var(--cyan-soft);
    color: var(--cyan);
}

.coach-workflow-icon.mint {
    background: var(--mint-soft);
    color: var(--mint);
}

.coach-workflow-card > span:nth-child(2) {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.coach-workflow-card strong {
    font-size: .78rem;
}

.coach-workflow-card small {
    color: var(--text-muted);
    font-size: .62rem;
    line-height: 1.5;
}

.coach-workflow-card > .app-icon {
    color: var(--text-faint);
}

.coach-assistant-heading {
    margin-top: 4px;
}

.coach-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.coach-card {
    position: relative;
    display: flex;
    min-height: 300px;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    transition: border-color .25s ease, transform .25s var(--ease), box-shadow .25s ease;
}

.coach-card:hover {
    border-color: rgba(139, 124, 255, .18);
    box-shadow: var(--shadow-violet);
    transform: translateY(-3px);
}

.coach-card-glow {
    position: absolute;
    top: -50px;
    right: -40px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(139, 124, 255, .085);
    filter: blur(25px);
}

.coach-card-head {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.coach-avatar,
.manager-preview-avatar {
    display: grid;
    width: 53px;
    height: 53px;
    place-items: center;
    border: 1px solid rgba(139, 124, 255, .17);
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(139, 124, 255, .16), rgba(85, 217, 245, .065));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
    font-size: 1.5rem;
}

.coach-card-copy {
    position: relative;
    margin-top: 20px;
}

.coach-card-copy h2 {
    font-size: 1.05rem;
    font-weight: 680;
    letter-spacing: -.03em;
}

.coach-card-copy p {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: .72rem;
    line-height: 1.6;
}

.coach-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 16px;
}

.coach-tags > span {
    padding: 4px 7px;
    border: 1px solid rgba(139, 124, 255, .12);
    border-radius: 7px;
    background: rgba(139, 124, 255, .06);
    color: #9991c6;
    font-size: .55rem;
    font-weight: 700;
    letter-spacing: .045em;
}

.coach-open-button {
    display: flex;
    min-height: 43px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .025);
    color: var(--text-soft);
    font-size: .71rem;
    font-weight: 650;
}

.coach-open-button:hover {
    border-color: rgba(139, 124, 255, .22);
    background: var(--violet-soft);
    color: #d0caff;
}

.coach-card-new {
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 14px;
    border-style: dashed;
    background: rgba(255, 255, 255, .015);
    color: var(--text-muted);
}

.coach-card-new:hover {
    color: var(--text-soft);
}

.coach-new-icon {
    display: grid;
    width: 50px;
    height: 50px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 16px;
    background: var(--violet-soft);
    color: #afa5ff;
}

.coach-card-new > span:last-child {
    display: flex;
    max-width: 180px;
    flex-direction: column;
    gap: 4px;
}

.coach-card-new strong {
    color: inherit;
    font-size: .82rem;
}

.coach-card-new small {
    color: var(--text-faint);
    font-size: .65rem;
}

/* Assistant manager */

.manager-page {
    max-width: 1180px;
}

.manager-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
}

.manager-preview {
    position: sticky;
    top: 0;
    display: flex;
    min-height: 330px;
    align-items: center;
    flex-direction: column;
    padding: 25px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.manager-preview-avatar {
    width: 70px;
    height: 70px;
    margin-top: 23px;
    border-radius: 21px;
    font-size: 2rem;
}

.manager-preview h2 {
    margin-top: 16px;
    font-size: 1.05rem;
    font-weight: 680;
    letter-spacing: -.03em;
}

.manager-preview p {
    display: -webkit-box;
    max-height: 68px;
    margin-top: 7px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .69rem;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.manager-preview .coach-tags {
    justify-content: center;
}

.manager-form {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 12px;
}

.form-card {
    padding: 22px;
    border-radius: var(--radius-lg);
}

.form-card-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.form-card-heading > span {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 9px;
    background: var(--violet-soft);
    color: #aaa0ee;
    font-family: var(--mono);
    font-size: .6rem;
    font-weight: 700;
}

.form-card-heading h2 {
    font-size: .9rem;
    font-weight: 660;
}

.form-card-heading p {
    margin-top: 3px;
    color: var(--text-faint);
    font-size: .67rem;
}

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

.form-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 620;
}

.form-field > small {
    align-self: flex-end;
    color: var(--text-faint);
    font-size: .6rem;
    font-weight: 500;
}

.input-field {
    width: 100%;
    padding: 0 13px;
    font-size: .76rem;
}

.input-field::placeholder {
    color: #4d5369;
}

.icon-field .input-field {
    font-size: 1.2rem;
    text-align: center;
}

.textarea-tall {
    min-height: 130px;
    padding-top: 12px;
    padding-bottom: 12px;
    line-height: 1.6;
    resize: vertical;
}

.topic-fieldset {
    margin: 18px 0 0;
    padding: 16px 0 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.topic-fieldset legend {
    padding: 0;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 620;
}

.tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 11px;
}

.tag-check {
    position: relative;
}

.tag-check input {
    position: absolute;
    opacity: 0;
}

.tag-check > span {
    display: inline-flex;
    min-height: 33px;
    align-items: center;
    gap: 5px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, .02);
    color: var(--text-faint);
    font-size: .6rem;
    font-weight: 680;
}

.tag-check .app-icon {
    opacity: 0;
}

.tag-check input:checked + span {
    border-color: rgba(139, 124, 255, .2);
    background: var(--violet-soft);
    color: #b7aff1;
}

.tag-check input:checked + span .app-icon {
    opacity: 1;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 2px 20px;
}

.manager-delete {
    margin-left: auto;
}

/* Chat */

.chat-page {
    display: flex;
    width: min(100%, 1220px);
    height: 100%;
    min-height: 680px;
    flex-direction: column;
    gap: 10px;
    margin: 0 auto;
    padding: 2px 4px;
}

.chat-route-loading {
    flex: 1;
}

.chat-topbar {
    position: relative;
    z-index: 30;
    display: flex;
    min-height: 72px;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    border-radius: 19px;
}

.chat-back {
    margin-right: 2px;
}

.chat-topbar-avatar {
    display: grid;
    width: 43px;
    height: 43px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(139, 124, 255, .16);
    border-radius: 14px;
    background: var(--violet-soft);
    font-size: 1.25rem;
}

.chat-topbar-meta {
    min-width: 0;
    flex: 1;
}

.chat-title {
    overflow: hidden;
    font-size: .92rem;
    font-weight: 680;
    letter-spacing: -.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    color: var(--text-faint);
    font-size: .62rem;
}

.chat-topbar-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.chat-model-picker {
    position: relative;
}

.chat-model-chip {
    display: flex;
    height: 39px;
    max-width: 275px;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    color: var(--text-muted);
}

.chat-model-chip:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.chat-model-chip-label {
    color: var(--text-faint);
    font-size: .59rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.chat-model-chip-value {
    overflow: hidden;
    font-size: .68rem;
    font-weight: 620;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-model-chip-caret {
    transform: rotate(90deg);
}

.chat-model-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: transparent;
}

.chat-model-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + 7px);
    right: 0;
    width: min(300px, 80vw);
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: rgba(17, 19, 32, .97);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
    animation: float-in .18s var(--ease);
}

.chat-model-option {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-size: .7rem;
    text-align: left;
}

.chat-model-option:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.chat-model-option.selected {
    background: var(--violet-soft);
    color: #c4bcff;
}

.chat-model-option-check {
    color: var(--mint);
}

.chat-notice {
    flex: 0 0 auto;
}

.chat-notice a {
    margin-left: auto;
    color: var(--cyan);
    font-weight: 650;
}

.chat-guided-context {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
}

.chat-guided-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 10px;
    background: var(--violet-soft);
    color: #b2aaff;
}

.chat-guided-context > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.chat-guided-context strong {
    color: var(--text-soft);
    font-size: .67rem;
}

.chat-guided-context div span,
.chat-guided-context small {
    color: var(--text-faint);
    font-size: .56rem;
}

.chat-guided-context small {
    white-space: nowrap;
}

.scramble-warning {
    border-color: rgba(247, 200, 117, .12);
    background: var(--amber-soft);
    color: #d2b986;
}

.chat-context-stack {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
}

.scramble-orientation-card {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 16px;
}

.scramble-orientation-visual {
    position: relative;
    width: 45px;
    height: 42px;
    flex: 0 0 auto;
}

.scramble-cube-top,
.scramble-cube-front {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: var(--mono);
}

.scramble-cube-top {
    top: 0;
    left: 10px;
    width: 30px;
    height: 18px;
    border-radius: 5px 5px 2px 2px;
    background: #e7e9f0;
    color: #313546;
    transform: skewX(-28deg);
}

.scramble-cube-front {
    top: 18px;
    left: 10px;
    width: 30px;
    height: 23px;
    border-radius: 2px 2px 5px 5px;
    background: #39b982;
    color: #07130e;
}

.scramble-cube-top span,
.scramble-cube-front span {
    font-size: .58rem;
    font-weight: 800;
    line-height: 1;
}

.scramble-cube-top small,
.scramble-cube-front small {
    font-size: .35rem;
}

.scramble-orientation-copy {
    min-width: 0;
    flex: 1;
}

.scramble-orientation-title {
    color: var(--text-soft);
    font-size: .69rem;
    font-weight: 640;
}

.scramble-orientation-scramble {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.scramble-orientation-scramble > span {
    color: var(--text-faint);
    font-size: .55rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.scramble-orientation-scramble code,
.verified-solution-card code {
    overflow: hidden;
    color: #aeb3c7;
    font-family: var(--mono);
    font-size: .61rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.verified-solution-card {
    width: min(40%, 420px);
    min-width: 260px;
    padding: 12px 14px;
    border-radius: 16px;
}

.verified-solution-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
}

.verified-solution-heading > span {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--mint);
    font-size: .61rem;
    font-weight: 680;
}

.verified-solution-heading small {
    color: var(--text-faint);
    font-size: .52rem;
}

.message-list {
    display: flex;
    min-height: 300px;
    flex: 1;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 30px max(20px, 8%) 24px;
    scroll-behavior: smooth;
}

.chat-empty-state {
    display: flex;
    max-width: 540px;
    align-items: center;
    align-self: center;
    justify-content: center;
    flex: 1;
    flex-direction: column;
    margin: auto;
    padding: 30px 18px;
    text-align: center;
}

.chat-missing {
    min-height: 420px;
    margin: auto;
    border-radius: var(--radius-xl);
}

.empty-icon {
    display: grid;
    width: 55px;
    height: 55px;
    place-items: center;
    border-radius: 17px;
    background: var(--violet-soft);
    color: #aea5f3;
}

.chat-empty-icon {
    position: relative;
    display: grid;
    width: 75px;
    height: 75px;
    place-items: center;
    margin-bottom: 18px;
    border: 1px solid rgba(139, 124, 255, .16);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(139, 124, 255, .16), rgba(85, 217, 245, .06));
    font-size: 2rem;
    box-shadow: 0 20px 60px rgba(72, 53, 172, .18);
}

.chat-empty-title {
    margin-top: 14px;
    font-size: 1.25rem;
    font-weight: 680;
    letter-spacing: -.04em;
}

.chat-empty-hint {
    max-width: 440px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: .75rem;
    line-height: 1.65;
}

.chat-empty-state .btn-primary {
    margin-top: 20px;
}

.chat-prompt-suggestions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 20px;
}

.chat-prompt-suggestions button {
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: .65rem;
}

.chat-prompt-suggestions button:hover {
    border-color: rgba(139, 124, 255, .2);
    background: var(--violet-soft);
    color: #c2bcf0;
}

.message-wrapper {
    display: flex;
    max-width: min(78%, 760px);
    align-items: flex-end;
    gap: 9px;
    animation: float-in .2s var(--ease);
}

.user-side {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.assistant-side {
    align-self: flex-start;
}

.msg-avatar {
    display: grid;
    width: 31px;
    height: 31px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: .58rem;
    font-weight: 700;
}

.assistant-side .msg-avatar {
    font-size: .95rem;
}

.message-bubble {
    min-width: 0;
    padding: 12px 14px 9px;
    border: 1px solid var(--border);
    border-radius: 17px;
    color: var(--text-soft);
    font-size: .76rem;
    line-height: 1.65;
}

.assistant-bubble {
    border-bottom-left-radius: 5px;
    background: rgba(255, 255, 255, .035);
}

.user-bubble {
    border-color: rgba(139, 124, 255, .17);
    border-bottom-right-radius: 5px;
    background: linear-gradient(145deg, rgba(139, 124, 255, .2), rgba(109, 92, 232, .12));
}

.message-content code {
    padding: 2px 5px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 5px;
    background: rgba(0, 0, 0, .18);
    color: #d4d0f5;
    font-family: var(--mono);
    font-size: .88em;
}

.message-content pre {
    margin: 9px 0;
    padding: 11px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(3, 4, 9, .48);
}

.message-content pre code {
    padding: 0;
    border: 0;
    background: transparent;
}

.message-meta {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 5px;
    color: var(--text-faint);
    font-size: .51rem;
}

.message-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--violet-bright);
    animation: typing 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }

@keyframes typing {
    0%, 60%, 100% { opacity: .25; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

.typing-label {
    margin-top: 3px;
    color: var(--text-faint);
    font-size: .58rem;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 3px;
    background: var(--violet-bright);
    vertical-align: -.12em;
    animation: blink .8s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.input-area {
    flex: 0 0 auto;
    padding: 9px;
    border-radius: 19px;
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.chat-input {
    min-height: 43px;
    max-height: 220px;
    flex: 1;
    padding: 11px 12px 9px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-soft);
    font-size: .78rem;
    line-height: 1.55;
    resize: none;
}

.chat-input::placeholder {
    color: var(--text-faint);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-icon-round,
.btn-send {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-color: var(--border);
    background: var(--surface-soft);
    color: var(--text-muted);
}

.btn-icon-round:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-send {
    border-color: rgba(139, 124, 255, .25);
    background: linear-gradient(135deg, #8b7cff, #6e5fe6);
    color: #fff;
    box-shadow: 0 8px 22px rgba(91, 70, 210, .23);
}

.btn-send:hover:not(:disabled) {
    transform: translateY(-1px);
}

.input-caption {
    padding: 3px 8px 0;
    color: #42485e;
    font-size: .53rem;
    text-align: center;
}

/* Algorithm library */

.alg-library-page {
    max-width: 1480px;
}

.alg-library-header {
    align-items: center;
}

.library-total {
    display: flex;
    min-width: 130px;
    align-items: flex-end;
    flex-direction: column;
}

.library-total strong {
    font-family: var(--mono);
    font-size: 1.7rem;
    font-weight: 620;
    letter-spacing: -.06em;
}

.library-total span {
    color: var(--text-faint);
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.library-total small {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 7px;
    color: #80e7bb;
    font-size: .55rem;
    font-weight: 680;
}

.library-total small > span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 9px rgba(142, 243, 208, .52);
}

.alg-filter-panel {
    position: sticky;
    z-index: 20;
    top: 0;
    padding: 14px;
    border-radius: var(--radius-lg);
}

.alg-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.alg-search-icon {
    position: absolute;
    left: 13px;
    color: var(--text-faint);
    pointer-events: none;
}

.alg-search-input {
    width: 100%;
    height: 48px;
    padding: 0 72px 0 42px;
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: 0;
    background: var(--input);
    color: var(--text-soft);
    font-size: .78rem;
}

.alg-search-input:focus {
    border-color: rgba(139, 124, 255, .48);
    box-shadow: 0 0 0 3px rgba(139, 124, 255, .08);
}

.alg-search-input::placeholder {
    color: var(--text-faint);
}

.alg-search-wrap > kbd {
    position: absolute;
    right: 12px;
}

.alg-search-clear {
    position: absolute;
    right: 41px;
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border-radius: 9px;
    background: transparent;
    color: var(--text-faint);
}

.alg-search-clear:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.alg-set-tabs {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.alg-set-tabs::-webkit-scrollbar,
.alg-subset-bar::-webkit-scrollbar {
    display: none;
}

.alg-tab {
    min-height: 36px;
    flex: 1;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--text-muted);
    font-size: .69rem;
    font-weight: 680;
    white-space: nowrap;
}

.alg-tab:hover {
    background: var(--surface-hover);
    color: var(--text-soft);
}

.alg-tab.active {
    border-color: rgba(139, 124, 255, .18);
    background: var(--violet-soft);
    color: #c1baff;
}

.alg-subset-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    overflow-x: auto;
    border-top: 1px solid var(--border);
    scrollbar-width: none;
}

.subset-label {
    margin-right: 4px;
    color: var(--text-faint);
    font-size: .58rem;
    font-weight: 730;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.alg-chip {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-faint);
    font-size: .61rem;
    font-weight: 620;
    white-space: nowrap;
}

.alg-chip:hover {
    border-color: var(--border-strong);
    color: var(--text-soft);
}

.alg-chip.active {
    border-color: rgba(85, 217, 245, .18);
    background: var(--cyan-soft);
    color: #9cdae7;
}

.alg-results-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 5px 12px;
}

.alg-result-count {
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: var(--text-muted);
    font-size: .7rem;
}

.alg-result-count strong {
    color: var(--text);
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 620;
}

.render-count {
    margin-left: 5px;
    color: var(--text-faint);
}

.alg-orientation-guide {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-faint);
    font-size: .64rem;
    text-align: right;
}

.alg-orientation-guide a {
    margin-left: 4px;
    color: #9b91ff;
    font-weight: 650;
    text-decoration: none;
}

.alg-orientation-guide a:hover {
    color: #b9b2ff;
    text-decoration: underline;
}

.alg-front-badge {
    display: grid;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(69, 223, 156, .18);
    border-radius: 7px;
    background: rgba(69, 223, 156, .1);
    color: #6fe2b0;
    font-family: var(--mono);
    font-size: .62rem;
    font-weight: 750;
}

.alg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 355px), 1fr));
    gap: 14px;
}

.alg-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius-lg);
    transition: border-color .25s ease, transform .25s var(--ease), box-shadow .25s ease;
    animation: float-in .25s var(--ease) both;
}

.alg-card:hover {
    border-color: rgba(139, 124, 255, .16);
    box-shadow: var(--shadow-violet);
    transform: translateY(-2px);
}

.alg-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 17px 18px 13px;
}

.alg-card-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.alg-set-label,
.alg-subset-badge {
    display: inline-flex;
    min-height: 21px;
    align-items: center;
    padding: 0 7px;
    border-radius: 7px;
    font-size: .54rem;
    font-weight: 750;
    letter-spacing: .065em;
    text-transform: uppercase;
}

.alg-set-label {
    background: var(--violet-soft);
    color: #ada4e8;
}

.alg-subset-badge {
    border: 1px solid var(--border);
    color: var(--text-faint);
}

.alg-case-name {
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 680;
    letter-spacing: -.03em;
}

.alg-count-badge {
    flex: 0 0 auto;
    padding: 4px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-faint);
    font-size: .56rem;
}

.alg-visual-stage {
    display: grid;
    min-height: 250px;
    place-items: center;
    margin: 0 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .045);
    border-radius: 17px;
    background:
        radial-gradient(circle at 50% 42%, rgba(139, 124, 255, .09), transparent 52%),
        rgba(5, 7, 13, .38);
}

.alg-card-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 15px 18px 18px;
}

.alg-card-provenance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 18px;
    border-top: 1px solid rgba(255, 255, 255, .055);
    background: rgba(5, 7, 13, .22);
}

.alg-verified-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #80e7bb;
    font-size: .53rem;
    font-weight: 680;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.alg-verified-status i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 9px rgba(142, 243, 208, .5);
}

.alg-card-provenance code {
    overflow: hidden;
    color: var(--text-faint);
    font-size: .5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alg-recognition {
    min-height: 73px;
    padding: 11px 12px;
    border: 1px solid rgba(85, 217, 245, .08);
    border-radius: 12px;
    background: rgba(85, 217, 245, .035);
}

.alg-detail-label {
    display: block;
    color: #8990a9;
    font-size: .56rem;
    font-weight: 750;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.alg-recognition p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: .67rem;
    line-height: 1.55;
}

.alg-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 15px 0 8px;
    color: var(--text-soft);
    font-size: .68rem;
    font-weight: 650;
}

.alg-section-heading small {
    color: var(--text-faint);
    font-size: .54rem;
    font-weight: 500;
}

.alg-moves-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alg-move-row {
    display: grid;
    width: 100%;
    min-height: 49px;
    grid-template-columns: 48px minmax(0, 1fr) 29px;
    align-items: center;
    gap: 8px;
    padding: 6px 7px 6px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .022);
    text-align: left;
}

.alg-move-row:hover {
    border-color: rgba(139, 124, 255, .2);
    background: rgba(139, 124, 255, .065);
}

.alg-variant-label {
    color: var(--text-faint);
    font-size: .55rem;
    font-weight: 680;
}

.alg-move-text {
    overflow: hidden;
    color: #dadcea;
    font-family: var(--mono);
    font-size: .67rem;
    font-weight: 560;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alg-copy-btn {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 8px;
    color: var(--text-faint);
}

.alg-move-row:hover .alg-copy-btn {
    background: rgba(139, 124, 255, .1);
    color: #b9afff;
}

.alg-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.alg-tip,
.alg-fingertrick {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--text-muted);
    font-size: .62rem;
}

.alg-tip .alg-detail-label,
.alg-fingertrick .alg-detail-label {
    margin-bottom: 4px;
}

.alg-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 9px;
    padding: 28px 0 8px;
}

.alg-load-more .btn-secondary .app-icon {
    transform: rotate(90deg);
}

.alg-load-more > span {
    color: var(--text-faint);
    font-size: .59rem;
}

.alg-empty {
    display: flex;
    min-height: 330px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 35px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.alg-empty h2 {
    margin-top: 14px;
    font-size: 1rem;
}

.alg-empty p {
    max-width: 440px;
    margin: 6px 0 18px;
    color: var(--text-muted);
    font-size: .72rem;
}

/* Cube case diagrams */

.case-diagram {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin: 0;
}

.ll-preview {
    position: relative;
    display: grid;
    width: 166px;
    height: 166px;
    grid-template-columns: 15px 1fr 15px;
    grid-template-rows: 15px 1fr 15px;
    gap: 5px;
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .28));
}

.ll-up-face,
.three-face-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
}

.ll-up-face {
    grid-area: 2 / 2;
    padding: 8px;
    border: 2px solid rgba(255, 255, 255, .17);
    border-radius: 15px;
    background: rgba(8, 9, 15, .85);
}

.ll-side-strip {
    display: grid;
    gap: 4px;
}

.ll-side-strip-back,
.ll-side-strip-front {
    grid-template-columns: repeat(3, 1fr);
}

.ll-side-strip-left,
.ll-side-strip-right {
    grid-template-rows: repeat(3, 1fr);
}

.ll-side-strip-back { grid-area: 1 / 2; }
.ll-side-strip-front { grid-area: 3 / 2; }
.ll-side-strip-left { grid-area: 2 / 1; }
.ll-side-strip-right { grid-area: 2 / 3; }

.case-sticker {
    min-width: 0;
    min-height: 0;
    border-radius: 4px;
    background: #202433;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}

.ll-side-strip .case-sticker {
    border-radius: 3px;
}

.case-sticker.y,
.case-key-swatch.y { background: linear-gradient(145deg, #ffe877, #e3bb3d); }
.case-sticker.k,
.case-key-swatch.k { background: linear-gradient(145deg, #2d3242, #171a25); }
.case-sticker.w { background: linear-gradient(145deg, #fff, #dce3ed); }
.case-sticker.r { background: linear-gradient(145deg, #ff7180, #cf3c51); }
.case-sticker.b { background: linear-gradient(145deg, #63b1ff, #3675d4); }
.case-sticker.g { background: linear-gradient(145deg, #55e0a5, #1ea96f); }
.case-sticker.o { background: linear-gradient(145deg, #ffb25f, #e77727); }

.case-diagram-caption {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    color: var(--text-faint);
    font-size: .57rem;
}

.case-diagram-caption strong {
    color: #67dca5;
}

.case-view-label {
    color: var(--text-muted);
    font-weight: 650;
}

.case-diagram-key {
    display: flex;
    gap: 10px;
    margin-top: 7px;
}

.case-diagram-key > span {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-faint);
    font-size: .51rem;
}

.case-key-swatch {
    width: 7px;
    height: 7px;
    border-radius: 2px;
}

.case-diagram-hint {
    margin-top: 6px;
    color: var(--text-faint);
    font-size: .51rem;
}

.three-face-preview {
    position: relative;
    width: 190px;
    height: 150px;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, .25));
}

.three-face {
    position: absolute;
    width: 92px;
}

.three-face-up {
    top: 0;
    left: 49px;
    transform: skewX(-28deg) scaleY(.74);
    transform-origin: bottom;
}

.three-face-primary {
    top: 60px;
    left: 17px;
    transform: skewY(17deg);
}

.three-face-side {
    top: 60px;
    right: 16px;
    transform: skewY(-17deg);
}

.three-face-grid {
    width: 100%;
    aspect-ratio: 1;
    padding: 6px;
    border: 2px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: rgba(8, 9, 15, .9);
}

.three-face-label {
    position: absolute;
    z-index: 2;
    top: 4px;
    left: 6px;
    display: grid;
    width: 16px;
    height: 16px;
    place-items: center;
    border-radius: 5px;
    background: rgba(4, 5, 10, .65);
    color: var(--text-soft);
    font-family: var(--mono);
    font-size: .5rem;
    font-weight: 750;
}

/* Not found and error UI */

.not-found-page {
    display: flex;
    min-height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px 20px;
    text-align: center;
}

.not-found-orbit {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 24px;
    color: #555b72;
    font-family: var(--mono);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 650;
    letter-spacing: -.09em;
}

.not-found-orbit img {
    width: clamp(58px, 9vw, 90px);
    border-radius: 25%;
    box-shadow: var(--shadow-violet);
    transform: rotate(12deg);
}

.not-found-title {
    margin-top: 9px;
    font-size: clamp(1.7rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -.055em;
}

.not-found-text {
    max-width: 440px;
    margin: 10px 0 22px;
    color: var(--text-muted);
    font-size: .8rem;
}

#blazor-error-ui {
    position: fixed;
    z-index: 10000;
    right: 20px;
    bottom: 20px;
    display: none;
    min-width: 310px;
    align-items: center;
    gap: 12px;
    padding: 13px 45px 13px 14px;
    border: 1px solid rgba(255, 126, 157, .22);
    border-radius: 14px;
    background: rgba(42, 17, 27, .95);
    box-shadow: var(--shadow);
    color: #f2beca;
    font-size: .72rem;
    backdrop-filter: blur(18px);
}

#blazor-error-ui .reload {
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: transparent;
    color: #c98596;
}

.blazor-error-boundary {
    padding: 20px;
    border-radius: 14px;
    background: var(--danger-soft);
    color: #f2adbd;
}

/* Responsive */

@media (max-width: 1180px) {
    .timer-workspace {
        grid-template-columns: minmax(0, 1.35fr) minmax(310px, .82fr);
    }

    .timer-stat-card {
        min-height: 101px;
        padding: 12px;
    }

    .timer-display {
        font-size: clamp(5rem, 10vw, 8rem);
    }

    .coach-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    :root {
        --sidebar-w: 220px;
    }

    .app-logo-tagline,
    .nav-item-hint,
    .sidebar-local-note small {
        display: none;
    }

    .timer-workspace {
        grid-template-columns: 1fr;
    }

    .timer-stage {
        min-height: 480px;
    }

    .timer-stats-panel {
        min-height: 380px;
    }

    .timer-trend {
        min-height: 145px;
    }

    .connection-content {
        grid-template-columns: 1fr;
        gap: 18px;
    }

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

    .chat-context-stack {
        flex-direction: column;
    }

    .verified-solution-card {
        width: 100%;
    }
}

@media (max-width: 768px) {
    html,
    body {
        overflow: hidden;
    }

    .app-shell {
        display: block;
        padding: 0;
    }

    .mobile-only,
    .mobile-topbar {
        display: flex;
    }

    .mobile-topbar {
        position: fixed;
        z-index: 90;
        top: 0;
        right: 0;
        left: 0;
        height: calc(64px + env(safe-area-inset-top));
        align-items: center;
        justify-content: space-between;
        padding: env(safe-area-inset-top) 14px 0;
        border-bottom: 1px solid var(--border);
        background: rgba(10, 11, 20, .8);
        backdrop-filter: blur(22px);
    }

    .mobile-brand img {
        width: 33px;
        height: 33px;
        border-radius: 10px;
    }

    .mobile-brand span {
        font-size: .89rem;
        font-weight: 720;
        letter-spacing: -.03em;
    }

    .mobile-menu-btn {
        position: absolute;
        top: calc(12px + env(safe-area-inset-top));
        right: 14px;
        display: grid;
        width: 39px;
        height: 39px;
        place-items: center;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface-soft);
        color: var(--text-muted);
    }

    .main-content {
        height: 100%;
        padding-top: calc(64px + env(safe-area-inset-top));
    }

    .sidebar {
        position: fixed;
        z-index: 120;
        top: 10px;
        bottom: 10px;
        left: 10px;
        width: min(310px, calc(100vw - 34px));
        min-width: 0;
        height: auto;
        transform: translateX(calc(-100% - 20px));
        transition: transform .3s var(--ease);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 110;
        inset: 0;
        border: 0;
        background: rgba(2, 3, 8, .64);
        backdrop-filter: blur(5px);
    }

    .app-logo-tagline,
    .nav-item-hint,
    .sidebar-local-note small {
        display: initial;
    }

    .page-container {
        padding: 10px 12px calc(40px + env(safe-area-inset-bottom));
    }

    .page-hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
        padding: 20px 3px 23px;
    }

    .page-hero h1 {
        font-size: 2.25rem;
    }

    .page-hero p {
        font-size: .82rem;
    }

    .timer-page {
        gap: 10px;
        padding: 8px 9px calc(35px + env(safe-area-inset-bottom));
    }

    .timer-command-bar {
        min-height: 58px;
    }

    .command-icon,
    .timer-session-control label {
        display: none;
    }

    .timer-session-control select {
        min-width: 0;
        width: min(46vw, 230px);
    }

    .timer-event-control {
        padding: 0 10px;
    }

    .scramble-card {
        display: flex;
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        padding: 14px;
    }

    .scramble-diagram {
        width: 100%;
        padding: 10px 0 0;
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .scramble-heading {
        align-items: center;
        flex-direction: row;
        padding: 0 0 9px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .scramble-text {
        padding: 5px 3px;
        font-size: .81rem;
        line-height: 1.65;
    }

    .scramble-text.long,
    .scramble-text.very-long {
        max-height: 9.2rem;
        padding-right: 5px;
        overflow-y: auto;
        font-size: .72rem;
        line-height: 1.55;
        text-align: left;
        overscroll-behavior: contain;
    }

    .timer-stage {
        min-height: clamp(320px, 48dvh, 430px);
    }

    .timer-stage-ring-one {
        width: 280px;
        height: 280px;
    }

    .timer-stage-ring-two {
        width: 370px;
        height: 370px;
    }

    .timer-display {
        font-size: clamp(4.2rem, 20vw, 7.5rem);
    }

    .timer-shortcut-hint {
        display: none;
    }

    .timer-quick-penalties {
        bottom: 20px;
    }

    .timer-stats-panel {
        min-height: 370px;
        padding: 18px;
    }

    .solve-log {
        padding: 18px 14px;
    }

    .solve-log-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .solve-log-actions {
        justify-content: flex-start;
    }

    .solve-table-wrap {
        overflow: visible;
    }

    .solve-table,
    .solve-table tbody {
        display: block;
        width: 100%;
    }

    .solve-table {
        min-width: 0;
    }

    .solve-table thead {
        display: none;
    }

    .solve-table tbody {
        display: grid;
        gap: 8px;
        padding-top: 10px;
    }

    .solve-table tbody tr {
        position: relative;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px 8px;
        padding: 10px 42px 10px 10px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: rgba(255, 255, 255, .018);
    }

    .solve-table td {
        display: flex;
        height: auto;
        min-height: 33px;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 5px 6px;
        overflow: visible;
        border: 0;
        text-overflow: initial;
        white-space: normal;
    }

    .solve-table td::before {
        color: var(--text-faint);
        content: attr(data-label);
        font-family: var(--font);
        font-size: .54rem;
        font-weight: 720;
        letter-spacing: .06em;
        text-transform: uppercase;
    }

    .solve-table td:nth-child(5),
    .solve-table td:nth-child(6) {
        grid-column: 1 / -1;
    }

    .solve-table td:nth-child(5) {
        display: block;
    }

    .solve-table td:nth-child(5)::before {
        display: block;
        margin-bottom: 4px;
    }

    .solve-table td:last-child {
        position: absolute;
        top: 8px;
        right: 7px;
        display: block;
        padding: 0;
    }

    .solve-table td:last-child::before {
        display: none;
    }

    .solve-scramble {
        display: -webkit-box;
        overflow: hidden;
        line-height: 1.5;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .timer-toast,
    .alg-toast {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom));
        left: 14px;
        justify-content: center;
    }

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

    .settings-wide {
        grid-column: auto;
    }

    .settings-section {
        padding: 19px;
    }

    .connection-status {
        margin-left: auto;
    }

    .coach-privacy-banner {
        grid-template-columns: auto 1fr;
    }

    .coach-privacy-banner > a {
        grid-column: 2;
    }

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

    .coach-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .coach-local-focus {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .coach-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .coach-section-heading > p {
        text-align: left;
    }

    .coach-workflow-grid {
        grid-template-columns: 1fr;
    }

    .coach-workflow-card {
        min-height: 105px;
    }

    .coach-card {
        min-height: 280px;
    }

    .manager-layout {
        grid-template-columns: 1fr;
    }

    .manager-preview {
        position: relative;
        min-height: 250px;
    }

    .chat-page {
        min-height: 0;
        height: calc(100dvh - 64px);
        padding: 7px 8px 8px;
    }

    .chat-topbar {
        min-height: 61px;
    }

    .chat-back {
        display: none;
    }

    .chat-model-chip-label {
        display: none;
    }

    .chat-model-chip {
        max-width: 170px;
    }

    .chat-context-stack {
        max-height: 130px;
        overflow-y: auto;
    }

    .scramble-orientation-card {
        flex: 0 0 auto;
    }

    .message-list {
        min-height: 0;
        padding: 20px 8px;
    }

    .message-wrapper {
        max-width: 90%;
    }

    .input-caption {
        display: none;
    }

    .alg-library-header {
        flex-direction: row;
    }

    .library-total {
        min-width: 90px;
    }

    .alg-filter-panel {
        top: 0;
        padding: 10px;
    }

    .alg-tab {
        flex: 0 0 auto;
    }

    .alg-results-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .alg-orientation-guide {
        text-align: left;
    }

    .alg-visual-stage {
        min-height: 235px;
    }
}

@media (max-width: 520px) {
    .timer-command-bar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        padding: 8px;
    }

    .timer-session-control {
        min-width: 0;
        flex: 1;
    }

    .timer-session-control select {
        flex: 1;
        width: 0;
        min-width: 0;
    }

    .timer-event-control {
        min-width: 76px;
        padding: 0 5px 0 9px;
    }

    .timer-top-actions > .icon-button {
        display: none;
    }

    .timer-event-select {
        width: 49px;
        padding-right: 14px;
    }

    .timer-stage {
        min-height: clamp(305px, 46dvh, 390px);
    }

    .timer-stage::after {
        display: none;
    }

    .timer-display {
        margin-top: 21px;
        font-size: clamp(3.8rem, 21vw, 6rem);
    }

    .timer-instruction {
        max-width: 250px;
        padding: 0 14px;
        font-size: .72rem;
    }

    .timer-quick-penalties {
        max-width: calc(100% - 24px);
    }

    .timer-quick-penalties > span {
        display: none;
    }

    .timer-stat-grid {
        gap: 7px;
    }

    .timer-stat-card {
        min-height: 94px;
    }

    .timer-stat-card strong {
        font-size: 1.1rem;
    }

    .log-action {
        flex: 1 0 auto;
    }

    .solve-empty {
        padding: 30px 10px;
    }

    .data-summary {
        gap: 5px;
    }

    .data-summary strong {
        font-size: 1rem;
    }

    .setting-row {
        gap: 10px;
    }

    .setting-field {
        align-items: flex-start;
        flex-direction: column;
    }

    .setting-field select {
        width: 100%;
    }

    .settings-section-heading {
        align-items: flex-start;
    }

    .connection-status {
        padding: 5px 7px;
        font-size: 0;
    }

    .connection-actions {
        min-width: 0;
    }

    .connection-actions > * {
        width: 100%;
    }

    .coach-privacy-banner {
        padding: 13px;
    }

    .coach-privacy-banner p {
        margin-top: 5px;
    }

    .coach-card-new {
        min-height: 190px;
    }

    .coach-practice-overview {
        padding: 15px;
    }

    .coach-practice-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .coach-metric-grid > div {
        min-height: 67px;
    }

    .form-grid {
        grid-template-columns: 82px minmax(0, 1fr);
    }

    .form-actions > button {
        flex: 1 1 auto;
    }

    .manager-delete {
        width: 100%;
        margin-left: 0;
    }

    .chat-topbar-avatar {
        width: 37px;
        height: 37px;
    }

    .chat-subtitle {
        display: none;
    }

    .chat-model-chip {
        width: 40px;
        padding: 0;
        justify-content: center;
    }

    .chat-model-chip-value {
        display: none;
    }

    .chat-model-chip-caret {
        display: block;
    }

    .chat-model-menu {
        right: -45px;
    }

    .chat-context-stack {
        display: none;
    }

    .chat-guided-context {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .chat-guided-context small {
        display: none;
    }

    .message-wrapper {
        max-width: 96%;
    }

    .msg-avatar {
        display: none;
    }

    .message-bubble {
        padding: 10px 12px 8px;
    }

    .btn-icon-round {
        display: none;
    }

    .alg-library-header p {
        display: none;
    }

    .library-total strong {
        font-size: 1.35rem;
    }

    .alg-search-wrap > kbd {
        display: none;
    }

    .alg-search-input {
        padding-right: 48px;
    }

    .alg-search-clear {
        right: 10px;
    }

    .alg-card-heading {
        padding: 15px;
    }

    .alg-card-content {
        padding: 14px 15px 16px;
    }

    .alg-notes {
        grid-template-columns: 1fr;
    }

    #blazor-error-ui {
        right: 10px;
        bottom: 10px;
        left: 10px;
        min-width: 0;
    }
}

/* Native-style phone shell and touch ergonomics */
@media (max-width: 768px) {
    html,
    body {
        font-size: 16px;
    }

    .mobile-topbar {
        height: calc(56px + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 16px 0;
        background: rgba(9, 10, 18, .9);
    }

    .mobile-brand {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
        gap: 9px;
        color: var(--text);
    }

    .mobile-brand img {
        width: 31px;
        height: 31px;
    }

    .sidebar,
    .sidebar-backdrop {
        display: none !important;
    }

    .main-content {
        height: 100dvh;
        padding-top: calc(56px + env(safe-area-inset-top));
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    .mobile-bottom-nav {
        position: fixed;
        z-index: 100;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        height: calc(64px + env(safe-area-inset-bottom));
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 2px;
        padding: 5px 7px env(safe-area-inset-bottom);
        border-top: 1px solid rgba(255, 255, 255, .09);
        background: rgba(9, 10, 18, .94);
        box-shadow: 0 -12px 32px rgba(0, 0, 0, .28);
        backdrop-filter: blur(24px) saturate(140%);
        -webkit-backdrop-filter: blur(24px) saturate(140%);
    }

    .mobile-tab {
        position: relative;
        display: flex;
        min-width: 0;
        min-height: 52px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        border-radius: 13px;
        color: var(--text-faint);
        font-size: .64rem;
        font-weight: 660;
        transition: color .18s ease, background .18s ease;
    }

    .mobile-tab.active {
        background: linear-gradient(180deg, rgba(139, 124, 255, .16), rgba(139, 124, 255, .06));
        color: #c2baff;
    }

    .mobile-tab.active::before {
        position: absolute;
        top: -5px;
        width: 25px;
        height: 3px;
        border-radius: 0 0 4px 4px;
        background: var(--violet-bright);
        box-shadow: 0 0 13px rgba(139, 124, 255, .62);
        content: "";
    }

    .page-container {
        padding: 9px 12px 24px;
    }

    .page-hero {
        gap: 14px;
        padding: 17px 3px 20px;
    }

    .page-hero h1 {
        font-size: clamp(1.9rem, 9vw, 2.25rem);
    }

    .page-hero p {
        font-size: .92rem;
        line-height: 1.55;
    }

    input,
    select,
    textarea,
    .chat-input {
        font-size: 16px;
    }

    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select {
        min-height: 44px;
    }

    .coach-privacy-banner > a,
    .chat-notice > a {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
    }

    .icon-button,
    .btn-icon-round,
    .btn-send {
        width: 44px;
        height: 44px;
    }

    .btn-compact,
    .text-button,
    .log-action,
    .quick-penalty-button,
    .alg-tab,
    .alg-chip,
    .chat-prompt-suggestions button {
        min-height: 44px;
    }

    .timer-page {
        padding: 7px 9px 20px;
    }

    .scramble-card {
        gap: 5px;
        padding: 11px 12px;
    }

    .scramble-heading {
        padding-bottom: 6px;
    }

    .scramble-card .scramble-diagram {
        display: none;
    }

    .scramble-card.mobile-diagram-open .scramble-diagram {
        display: flex;
    }

    .scramble-text {
        padding: 2px 3px;
        font-size: .84rem;
        line-height: 1.5;
    }

    .scramble-quality {
        margin-top: 0;
        font-size: .61rem;
    }

    .timer-stage {
        min-height: clamp(300px, 46dvh, 390px);
    }

    .timer-toast,
    .alg-toast {
        bottom: calc(74px + env(safe-area-inset-bottom));
    }

    .coach-evidence-grid {
        grid-template-columns: 1fr;
    }

    .coach-evidence-grid > div {
        min-height: 54px;
    }

    .coach-card {
        min-height: 235px;
    }

    .chat-page {
        height: 100%;
        padding: 7px 8px;
    }

    .chat-back {
        display: grid;
    }

    .chat-context-stack {
        display: flex;
        max-height: 112px;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .chat-context-stack::-webkit-scrollbar {
        display: none;
    }

    .chat-context-stack > * {
        min-width: min(82vw, 430px);
        scroll-snap-align: start;
    }

    .chat-guided-context strong {
        font-size: .72rem;
    }

    .chat-guided-context div span {
        font-size: .62rem;
    }

    .message-content {
        font-size: .86rem;
        line-height: 1.58;
    }

    .chat-input {
        min-height: 46px;
        padding: 10px 8px 8px;
    }

    .alg-move-row {
        min-height: 60px;
        grid-template-columns: 44px minmax(0, 1fr) 36px;
        padding: 8px;
    }

    .alg-move-text {
        overflow: visible;
        font-size: .72rem;
        line-height: 1.5;
        overflow-wrap: anywhere;
        text-overflow: clip;
        white-space: normal;
    }

    .alg-copy-btn {
        width: 36px;
        height: 40px;
    }

    #blazor-error-ui {
        bottom: calc(74px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 520px) {
    .page-hero > .btn-primary,
    .page-hero > .btn-secondary,
    .form-actions,
    .settings-section .connection-actions {
        width: 100%;
    }

    .coach-practice-overview {
        padding: 14px;
    }

    .coach-metric-grid {
        gap: 6px;
    }

    .coach-metric-grid strong {
        font-size: .96rem;
    }

    .chat-topbar-avatar {
        display: none;
    }

    .chat-topbar {
        gap: 6px;
        padding: 7px;
    }

    .chat-topbar-actions {
        gap: 4px;
    }

    .chat-guided-context {
        padding: 8px 10px;
    }

    .btn-icon-round {
        display: inline-flex;
    }

    .input-row {
        gap: 4px;
    }

    .input-actions {
        gap: 3px;
    }

    .input-area {
        padding: 6px;
    }

    .manager-preview {
        min-height: 210px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
