/* Hootscape login.css — the login screen (DESIGN_BRIEF §3.4).
   A full-viewport courtyard canvas letterboxed on #000 at non-16:10 ratios; the HOOTSCAPE wordmark; a 400x240 stone box
   with two torch sconces; New User / Existing User forms; world selector bottom-left; Owl Link status bottom-right;
   loading tip; footer. The living courtyard (owl eyes that follow the cursor, Owlfred sweeping, the glider over the moon)
   is drawn on #login-canvas by the login agent; this file is only the chrome.
   Requires theme.css + ui.css. */

#login { position: fixed; inset: 0; background: #000; overflow: hidden; z-index: 50; font-family: var(--font-ui); }
#login.hidden { display: none; }
/* 16:10 stage, letterboxed: the largest 16:10 box that fits */
.login-stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(100vw, 160vh); height: min(100vh, 62.5vw); overflow: hidden; background: linear-gradient(to bottom, var(--sky-top), var(--sky-horizon)); }
#login-canvas, .login-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; cursor: default; }
.login-ui { position: absolute; inset: 0; pointer-events: none; }
.login-ui > * { pointer-events: auto; }

/* ---- Wordmark: stone-carved Pixelify Sans, 3px drop bevel, amber owl eyes in both O's ---- */
.wordmark { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); font-family: var(--font-display); font-weight: 700; font-size: 64px; line-height: 1; letter-spacing: 4px; color: var(--stone-hi); white-space: nowrap; text-align: center; pointer-events: none;
  text-shadow: 1px 1px 0 var(--stone-base), 2px 2px 0 var(--stone-base), 3px 3px 0 var(--stone-lo), 4px 4px 0 var(--stone-lo), 5px 5px 0 var(--stone-lo), 0 -1px 0 #8A7650, 0 0 24px rgba(0,0,0,.8); }
.wordmark .o { position: relative; display: inline-block; }
.wordmark .o::after { content: ""; position: absolute; left: 50%; top: 50%; width: .3em; height: .3em; margin: -.15em 0 0 -.15em; border-radius: 50%; background: var(--owl-eye); box-shadow: 0 0 6px 2px rgba(255,180,58,.55), inset -1px -1px 0 var(--amber-deep); animation: eye-glow 3.6s ease-in-out infinite; }
.wordmark .o:nth-of-type(2)::after { animation-delay: -1.8s; }
.wordmark.blink .o::after { transform: scaleY(.1); transition: transform 120ms; }
@keyframes eye-glow { 50% { box-shadow: 0 0 10px 3px rgba(255,180,58,.8); } }
.wordmark-sub { position: absolute; left: 50%; top: calc(9% + 70px); transform: translateX(-50%); font-family: var(--font-ui); font-size: 22px; color: var(--txt-orange); text-shadow: 1px 1px 0 var(--outline-ink), 0 0 12px rgba(0,0,0,.8); white-space: nowrap; pointer-events: none; }

/* ---- The 400x240 stone box ---- */
.login-box { position: absolute; left: 50%; top: 50%; width: 400px; height: 240px; transform: translate(-50%, -46%); display: flex; flex-direction: column; align-items: center; padding: 10px 24px 12px;
  background-color: var(--stone-fill); background-image: var(--noise); border: 2px solid; border-color: var(--stone-hi) var(--stone-lo) var(--stone-lo) var(--stone-hi);
  box-shadow: 0 0 0 1px var(--stone-lo), 4px 4px 0 rgba(0,0,0,.5), -14px 0 28px -10px rgba(255,140,26,.45), 14px 0 28px -10px rgba(255,140,26,.45); color: var(--txt-orange); }
.login-box.shake { animation: box-shake 120ms linear 2; }
@keyframes box-shake { 0%, 100% { transform: translate(-50%, -46%); } 25% { transform: translate(calc(-50% - 4px), -46%); } 75% { transform: translate(calc(-50% + 4px), -46%); } }
.login-title { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1; color: var(--txt-yellow); text-shadow: 2px 2px 0 var(--outline-ink); margin-bottom: 4px; white-space: nowrap; }
.login-tagline { font-size: var(--fs-body); line-height: 1.1; color: var(--txt-orange); text-align: center; min-height: 20px; margin-bottom: 8px; }
.login-screen { display: none; flex-direction: column; align-items: center; width: 100%; flex: 1 1 auto; }
.login-screen.active { display: flex; }
.login-choice { justify-content: center; gap: 14px; flex-direction: row; align-items: center; }
.login-choice .btn { min-width: 150px; min-height: 40px; font-size: var(--fs-header); }
.login-form { display: grid; grid-template-columns: 96px 1fr; gap: 6px 8px; align-items: center; width: 100%; }
.login-form label { color: var(--txt-orange); text-align: right; white-space: nowrap; }
.login-form .field { height: 26px; }
.login-form .field input { font-size: var(--fs-body); }
.login-form .span { grid-column: 1 / 3; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.login-form .check { font-size: var(--fs-body); }
.login-actions { display: flex; justify-content: center; gap: 12px; margin-top: auto; padding-top: 6px; width: 100%; }
.login-actions .btn { min-width: 110px; }
.login-error { grid-column: 1 / 3; min-height: 20px; color: var(--txt-red); text-align: center; line-height: 1; text-shadow: 1px 1px 0 var(--outline-ink); }
.login-error:empty { display: none; }
/* New user: compact two-column grid + owlet row + account type */
.login-new .login-form { gap: 3px 8px; grid-template-columns: 82px 1fr; }
.login-new .login-form .field { height: 24px; }
.owlet-row { grid-column: 1 / 3; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.owlet-row .lbl { color: var(--txt-orange); white-space: nowrap; }
.owlet { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: rgba(36,30,22,.5); border: 1px solid var(--stone-lo); box-shadow: inset 1px 1px 0 rgba(110,92,63,.4); }
.owlet .icon { width: 24px; height: 24px; image-rendering: pixelated; }
.owlet:hover { background: var(--slot-hover); }
.owlet.selected { box-shadow: inset 0 0 0 1px var(--amber), 0 0 6px rgba(255,180,58,.5); background: rgba(255,180,58,.12); }
.owlet-name { color: var(--txt-yellow); font-size: var(--fs-body); min-width: 60px; text-align: center; }
.account-type { grid-column: 1 / 3; display: flex; justify-content: center; gap: 2px; }
.account-type .btn { min-height: 24px; padding: 0 8px; font-size: var(--fs-body); }
.account-type .btn.active { color: var(--txt-yellow); }
.account-type .ironowl.active { color: var(--eq-iron); } .account-type .hardcore.active { color: var(--txt-red); }

/* The New User form needs more height than the 240 px welcome box; the box grows downwards and the tip follows */
.login-box:has(.login-new.active) { height: 300px; }
#login:has(.login-new.active) .login-tip { top: calc(50% + 196px); }

/* ---- Torch sconces hugging the box edges; the flames are canvas particles, this is the bark bracket + a CSS ember ---- */
.sconce { position: absolute; top: 50%; width: 20px; height: 56px; margin-top: -28px; pointer-events: none; }
.sconce.l { left: -26px; } .sconce.r { right: -26px; }
.sconce .bracket { position: absolute; left: 6px; top: 22px; width: 8px; height: 34px; background-color: var(--bark); background-image: var(--bark-grain); border: 1px solid var(--stone-lo); box-shadow: inset 1px 0 0 var(--bark-grain-hi); }
.sconce .bracket::after { content: ""; position: absolute; left: -4px; bottom: 0; width: 14px; height: 6px; background: var(--stone-base); border: 1px solid var(--stone-lo); }
.sconce .flame { position: absolute; left: 3px; top: 0; width: 14px; height: 26px; border-radius: 50% 50% 40% 40% / 60% 60% 40% 40%; background: radial-gradient(ellipse at 50% 80%, #FFF2B0 0 18%, var(--torch) 40%, var(--dusk-ember) 70%, transparent 72%); filter: blur(.4px); transform-origin: 50% 100%; animation: flame 0.42s ease-in-out infinite alternate; }
.sconce .flame::after { content: ""; position: absolute; inset: -18px -22px; border-radius: 50%; background: radial-gradient(circle, rgba(255,140,26,.45), transparent 65%); animation: flame-glow 0.9s ease-in-out infinite alternate; }
.sconce.r .flame { animation-delay: -0.21s; }
@keyframes flame { from { transform: scaleY(.92) skewX(-3deg); } to { transform: scaleY(1.08) skewX(4deg); } }
@keyframes flame-glow { from { opacity: .75; } to { opacity: 1; } }

/* ---- Loading tip beneath the box ---- */
.login-tip { position: absolute; left: 50%; top: calc(50% + 136px); transform: translateX(-50%); width: 560px; max-width: 92%; text-align: center; font-style: italic; font-size: var(--fs-body); color: var(--chat-paper); text-shadow: 1px 1px 0 var(--outline-ink), 0 0 10px rgba(0,0,0,.9); pointer-events: none; }
.login-tip b { color: var(--txt-yellow); font-weight: normal; }

/* ---- World selector bottom-left ---- */
.world-select { position: absolute; left: 16px; bottom: 44px; width: 380px; padding: 4px; background-color: var(--stone-fill); background-image: var(--noise); border: 2px solid; border-color: var(--stone-hi) var(--stone-lo) var(--stone-lo) var(--stone-hi); box-shadow: 0 0 0 1px var(--stone-lo), 3px 3px 0 rgba(0,0,0,.45); color: var(--txt-orange); }
.world-select .ws-title { font-family: var(--font-display); font-size: var(--fs-body); padding: 0 6px 2px; color: var(--txt-orange); text-shadow: 1px 1px 0 var(--outline-ink); }
.world-row { display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 22px 0 6px; cursor: pointer; white-space: nowrap; }
.world-row:hover { background: var(--slot-hover); color: var(--txt-yellow); }
.world-row.active { color: var(--txt-yellow); box-shadow: inset 2px 0 0 var(--amber); }
.world-row .ws-name { color: inherit; }
.world-row .ws-pop { margin-left: auto; color: var(--txt-green); }
.world-row .ws-roost { color: var(--moonlight); }
.world-row.full .ws-pop { color: var(--txt-red); }
.world-row.down { color: var(--txt-grey); cursor: default; }

/* ---- Owl Link status bottom-right ---- */
.owllink-status { position: absolute; right: 16px; bottom: 44px; display: flex; align-items: center; gap: 8px; padding: 4px 10px; background: rgba(36,30,22,.7); border: 1px solid var(--stone-lo); box-shadow: inset 1px 1px 0 rgba(110,92,63,.5); color: var(--txt-owllink); white-space: nowrap; }
.owllink-status.disconnected { color: var(--txt-grey); }

/* ---- Music toggle (owl icon) top-right; plays Hoot Main after the first click ---- */
.music-toggle { position: absolute; right: 16px; top: 16px; width: 36px; height: 36px; padding: 0; min-height: 0; }
.music-toggle .icon { width: 20px; height: 20px; }
.music-toggle.muted { color: var(--txt-grey); }
.music-toggle.muted .icon { opacity: .5; }

/* ---- Footer ---- */
.login-footer { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: var(--fs-body); color: var(--txt-grey); text-shadow: 1px 1px 0 var(--outline-ink); pointer-events: none; }
.login-footer a { pointer-events: auto; color: var(--txt-grey); }
.login-footer a:hover { color: var(--txt-yellow); }
.login-version { position: absolute; left: 16px; top: 16px; font-size: var(--fs-body); color: var(--txt-grey); text-shadow: 1px 1px 0 var(--outline-ink); }

/* ---- Walk-in sprite (your saved character by the castle door, drawn on the canvas; this is the name tag twin) ---- */
.login-walkin { position: absolute; left: 36%; bottom: 30%; color: var(--txt-white); text-shadow: 1px 1px 0 var(--outline-ink); font-size: var(--fs-body); pointer-events: none; opacity: 0; transition: opacity 300ms; }
.login-walkin.show { opacity: 1; }

/* ---- Fade to the world after login ---- */
#login.leaving { animation: login-fade 600ms ease-in forwards; }
@keyframes login-fade { to { opacity: 0; } }

/* ---- Small screens ---- */
@media (max-width: 640px) {
  .login-stage { width: 100vw; height: 100vh; transform: translate(-50%, -50%); }
  .wordmark { font-size: 40px; top: 6%; letter-spacing: 2px; }
  .wordmark-sub { top: calc(6% + 46px); font-size: 20px; }
  .login-box { width: calc(100vw - 32px); height: auto; min-height: 240px; top: 44%; transform: translate(-50%, -50%); padding: 10px 14px 12px; }
  .login-box.shake { animation-name: box-shake-m; }
  @keyframes box-shake-m { 0%, 100% { transform: translate(-50%, -50%); } 25% { transform: translate(calc(-50% - 4px), -50%); } 75% { transform: translate(calc(-50% + 4px), -50%); } }
  .sconce { display: none; }
  .login-form { grid-template-columns: 1fr; }
  .login-form label { text-align: left; }
  .login-form .span, .login-error, .owlet-row, .account-type { grid-column: 1; }
  .login-form .field, .login-new .login-form .field { height: 44px; }
  .login-choice .btn, .login-actions .btn, .account-type .btn { min-height: 44px; }
  .owlet { width: 44px; height: 44px; }
  .login-box:has(.login-new.active) { height: auto; }
  .login-tip, #login:has(.login-new.active) .login-tip { top: auto; bottom: 236px; width: calc(100vw - 32px); }
  .world-select { left: 8px; right: 8px; width: auto; bottom: 104px; }
  .world-row { height: 44px; }
  .owllink-status { right: 8px; left: 8px; bottom: 60px; justify-content: center; }
  .login-footer { bottom: 8px; font-size: 20px; padding: 0 8px; }
  .music-toggle { width: 44px; height: 44px; }
}
