body.auth-page { display: block; min-height: 100dvh; height: auto; overflow: auto; padding: 32px 20px; }
.auth-page main { max-width: 640px; margin: 5vh auto; padding: 0; height: auto; overflow: visible; }
.auth-page .panel { padding: clamp(20px, 4vw, 36px); animation: panelIn .35s var(--ease-out) both; }
.auth-page h1 { margin: 12px 0; font-size: clamp(24px, 5vw, 36px); }
.auth-page p { color: var(--muted); line-height: 1.8; }
.auth-page form { display: grid; gap: 20px; margin-top: 24px; }
.auth-page .field { min-width: 0; }
.auth-page .auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.auth-page .auth-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.auth-page .auth-actions > * { min-width: 0; }
.auth-page .auth-output { display: block; overflow-wrap: anywhere; white-space: pre-wrap; color: var(--ink); margin: 16px 0; }
.auth-page .admin-row { padding: 16px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.auth-page .admin-row .auth-actions { margin-top: 10px; }
.auth-page .admin-section { margin-top: 24px; }
/* Language toggle floats beside the panel title so a long English heading wraps around it */
/* Centred on the h1 line: its 12px top margin plus half its line box (clamp font × 1.45), minus half the button */
.panel-lang { float: right; width: 36px; height: 36px; margin: calc(12px + clamp(24px, 5vw, 36px) * .725 - 18px) 0 0 12px; }
.panel-lang .ms { font-size: 20px; }
.auth-page [hidden] { display: none !important; }
.auth-page a { color: var(--accent); }
/* Account rows reuse the system panel layout; the input group takes the space beside the label */
.account-panel { margin-top: 14px; }
.account-fields { flex: 0 1 460px; min-width: 0; }
.account-fields .input { flex: 1 1 120px; min-width: 0; width: auto; }
.account-fields .btn { flex-shrink: 0; }
.account-panel a.btn { text-decoration: none; }
body[data-auth-loading] > :is(main, nav) { visibility: hidden; }
@media (max-width: 720px) {
    .auth-page .auth-grid { grid-template-columns: 1fr; }
    .auth-page main { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) { .auth-page .panel { animation: none; } }

.auth-page .admin-row small { display: block; color: var(--muted); }
.auth-page pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.auth-page dialog { max-width: min(600px, calc(100vw - 32px)); }
.auth-page .dialog-body { display: flex; gap: 14px; margin: 0; }
.auth-page .dialog-body .auth-output { margin: 0; }
.rules-update { position: fixed; z-index: 100; top: 12px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 24px); width: max-content; padding: 12px 18px; background: var(--surface); border: 1px solid var(--accent); border-radius: 0; box-shadow: 0 8px 32px #0005; }
.rules-update[hidden] { display: none; }
.auth-page :is(#login-form, #register-form):not([hidden]) { animation: pageIn .25s var(--ease-out); }

/* Login title screen: hero party from the badge art, gold Cinzel logo and a game menu for login or sign-up */
.title-screen main { position: relative; z-index: 1; max-width: 440px; min-height: calc(100dvh - 64px); margin: 0 auto; display: flex; flex-direction: column; justify-content: center; }
.title-hero { display: grid; justify-items: center; text-align: center; margin-bottom: 20px; animation: pageIn .4s var(--ease-out) both; }
.title-hero p { margin: 0; }
.party { display: flex; align-items: flex-end; justify-content: center; margin-bottom: 16px; }
.party img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    padding: 3px;
    background: radial-gradient(circle at 30% 25%, #FFE3A0, var(--metal) 55%, var(--accent-deep));
    box-shadow: 0 0 0 1px var(--rim), 0 4px 0 var(--rim), 0 0 22px rgba(232, 176, 75, .3);
    animation: chipIn .5s var(--ease-spring) backwards, spriteBob 2.4s ease-in-out .5s infinite;
}
.party img:nth-child(1) { animation-delay: .15s, .65s; }
.party img:nth-child(2) {
    position: relative;
    z-index: 1;
    width: 108px;
    height: 108px;
    margin: 0 -12px;
    box-shadow: 0 0 0 1px var(--rim), 0 5px 0 var(--rim), 0 0 40px rgba(232, 176, 75, .55);
}
.party img:nth-child(3) { animation-delay: .3s, 1.1s; }
.title-screen .game-logo {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: clamp(32px, 9vw, 44px);
    line-height: 1.1;
    letter-spacing: .03em;
    background: var(--hero-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 0 var(--rim)) drop-shadow(0 0 16px rgba(232, 176, 75, .35));
}
.title-screen .guild-ribbon {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 10px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .3em;
}
.guild-ribbon::before, .guild-ribbon::after {
    content: "";
    width: 40px;
    height: 7px;
    background: linear-gradient(135deg, #FFE3A0, var(--accent-deep)) center / 7px 7px no-repeat, linear-gradient(90deg, transparent, var(--accent)) center / 100% 1px no-repeat;
    clip-path: polygon(0 45%, 82% 45%, 82% 0, 100% 50%, 82% 100%, 82% 55%, 0 55%);
}
.guild-ribbon::after { transform: scaleX(-1); }
.title-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) 42px;
    gap: 6px;
    padding: 4px;
    margin-bottom: 4px;
    border-radius: 0;
    background: var(--well);
    box-shadow: inset 0 2px 4px var(--well-shadow), inset 0 0 0 1px var(--well-line);
}
.title-menu button {
    position: relative;
    height: 42px;
    border-radius: 0;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: .08em;
    transition: color .15s, background-color .15s, box-shadow .15s;
}
.title-menu button:hover { color: var(--ink); }
.title-menu button[aria-pressed="true"] {
    color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(232, 176, 75, .45), 0 0 14px rgba(232, 176, 75, .18);
}
.title-menu button[aria-pressed="true"]::before { left: 12px; }
.title-menu .title-lang { display: grid; place-items: center; }
.title-menu .title-lang .ms { font-size: 20px; transition: transform .25s var(--ease-spring); }
.title-menu .title-lang:hover { color: var(--accent); }
.title-menu .title-lang:active .ms { transform: scale(.88); }
.title-screen .field > span { display: inline-flex; align-items: center; gap: 6px; }
.title-screen .field .ms { font-size: 16px; color: var(--accent); }
.title-screen .field small { color: var(--subtle); font-size: 12px; }
.title-screen form .btn { height: 46px; font-size: 15px; }
.title-foot { margin-top: 16px; text-align: center; font-size: 13px; }
.title-screen #login-error { margin: 16px 0 0; color: var(--hazard-on-cobalt); }
/* Embers drifting up the night sky; the shared bubble keyframe carries them bottom to top */
.embers { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.embers i {
    position: absolute;
    bottom: 0;
    left: var(--x);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #FFD27A;
    box-shadow: 0 0 8px 2px rgba(255, 180, 92, .6);
    opacity: 0;
    animation: bubble var(--d) linear var(--delay) infinite;
}
.embers i:nth-child(1) { --x: 8%;  --d: 11s; --delay: 0s; }
.embers i:nth-child(2) { --x: 22%; --d: 14s; --delay: 3s; width: 3px; height: 3px; }
.embers i:nth-child(3) { --x: 35%; --d: 12s; --delay: 6s; }
.embers i:nth-child(4) { --x: 51%; --d: 16s; --delay: 1.5s; width: 3px; height: 3px; }
.embers i:nth-child(5) { --x: 64%; --d: 13s; --delay: 8s; }
.embers i:nth-child(6) { --x: 77%; --d: 15s; --delay: 4.5s; width: 5px; height: 5px; }
.embers i:nth-child(7) { --x: 88%; --d: 12s; --delay: 9.5s; width: 3px; height: 3px; }
.embers i:nth-child(8) { --x: 95%; --d: 17s; --delay: 2s; }
@media (max-width: 720px) {
    .title-screen main { margin-top: 0; }
    .party img { width: 60px; height: 60px; }
    .party img:nth-child(2) { width: 92px; height: 92px; }
}
