.auth-page {
    background:
        radial-gradient(circle at 14% 8%, rgba(216, 240, 107, .2), transparent 26rem),
        radial-gradient(circle at 92% 86%, rgba(53, 117, 93, .11), transparent 28rem),
        var(--paper);
}

.auth-header { position: relative; }

.auth-shell {
    display: grid;
    min-height: calc(100svh - 72px);
    padding: 32px 16px;
    place-items: center;
}

.auth-card {
    width: min(430px, 100%);
    padding: clamp(24px, 5vw, 34px);
    background: rgba(255, 254, 250, .95);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-intro { margin-bottom: 25px; }

.auth-intro h1 {
    margin: 0;
    font-size: clamp(2rem, 7vw, 3rem);
    line-height: 1;
    letter-spacing: -.055em;
}

.auth-intro > p:last-child {
    margin: 13px 0 0;
    color: var(--ink-soft);
}

.auth-form { display: grid; gap: 18px; }
.auth-form .field-group { margin: 0; }
.auth-form .button { margin-top: 2px; }

.auth-error,
.auth-notice {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 10px;
    font-size: .87rem;
}

.auth-error {
    color: #7f2722;
    background: #fff2ef;
    border-color: #efc0b9;
    border-left: 4px solid var(--danger);
}

.auth-notice {
    color: var(--forest);
    background: #eff7e2;
    border-color: #cde0a9;
    border-left: 4px solid var(--grass);
}

.auth-footnote {
    margin: 22px 0 0;
    color: var(--ink-soft);
    font-size: .75rem;
    text-align: center;
}

.auth-login-link { white-space: nowrap; }

.account-menu { position: relative; }

.account-menu > summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 9px;
    padding: 5px 9px 5px 5px;
    color: white;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 11px;
    cursor: pointer;
    list-style: none;
}

.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover { background: rgba(255, 255, 255, .08); }

.account-avatar {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    color: var(--forest);
    background: var(--lime);
    border-radius: 9px;
    font-size: .8rem;
    font-weight: 900;
}

.account-summary-copy {
    display: flex;
    max-width: 160px;
    flex-direction: column;
    line-height: 1.15;
}

.account-summary-copy strong,
.account-summary-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-summary-copy strong { font-size: .77rem; }
.account-summary-copy small { margin-top: 3px; color: rgba(255, 255, 255, .67); font-size: .65rem; }

.account-popover {
    position: absolute;
    z-index: 100;
    top: calc(100% + 9px);
    right: 0;
    width: min(290px, calc(100vw - 32px));
    padding: 16px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: 0 18px 45px rgba(8, 30, 24, .22);
}

.account-popover p {
    display: flex;
    min-width: 0;
    flex-direction: column;
    margin: 0 0 13px;
}

.account-popover p strong,
.account-popover p span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-popover p strong { font-size: .88rem; }
.account-popover p span { margin-top: 3px; color: var(--ink-soft); font-size: .75rem; }

.read-only-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding: 14px 16px;
    color: var(--forest);
    background: #eef5e4;
    border: 1px solid #cfdda9;
    border-radius: 12px;
}

.read-only-notice p { margin: 0; font-size: .85rem; }
.read-only-notice strong { display: block; margin-bottom: 2px; }

.is-read-only input:disabled,
.is-read-only textarea:disabled,
.is-read-only select:disabled {
    color: var(--ink);
    background: #f3f5f0;
    opacity: 1;
    cursor: default;
}

.is-read-only .team-button:disabled { cursor: not-allowed; opacity: .48; }
.is-read-only .team-button:disabled:hover { transform: none; box-shadow: none; }

.is-read-only .tools-panel { display: block; }
.is-read-only .tools-panel .tool-section:not(:first-child) { display: none; }
.is-read-only .tools-panel .tool-section:first-child { border: 0; }
.is-read-only .tools-panel .tool-section:first-child > .field-group { display: none; }
.is-read-only .player-marker { cursor: pointer; }

.read-only-play-details {
    display: grid;
    gap: 14px;
    margin: 0;
}

.read-only-play-details div {
    min-width: 0;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--line);
}

.read-only-play-details div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.read-only-play-details dt {
    margin-bottom: 5px;
    color: var(--ink-soft);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.read-only-play-details dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: .88rem;
    line-height: 1.5;
    white-space: pre-line;
}

.play-audit-details {
    display: grid;
    gap: 11px;
    margin: 18px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.play-audit-details div { min-width: 0; }

.play-audit-details dt {
    margin-bottom: 3px;
    color: var(--ink-soft);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.play-audit-details dd {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    overflow-wrap: anywhere;
}

.play-audit-details strong { color: var(--ink); font-size: .76rem; }
.play-audit-details time,
.play-audit-details .audit-date-fallback { color: var(--ink-soft); font-size: .68rem; }

@media (max-width: 760px) {
    .account-summary-copy { display: none; }
    .account-menu > summary { padding-right: 5px; }
    .read-only-notice { align-items: stretch; flex-direction: column; }
}

@media (max-width: 480px) {
    .auth-shell { padding: 18px 12px; }
    .auth-card { padding: 22px 18px; }
    .auth-login-link { padding-inline: 10px; font-size: .76rem; }
}

@media (max-width: 580px) {
    .app-header .brand-copy,
    .library-label,
    .library-location { display: none; }
}
