/* Launcher screen (name entry + boot status).
   Background: assets/launcher-bg.* (supplied by the project owner). Emblem: the game's own favicon.
   Cursor: assets/cursor-sword*.svg (original design for this port). */
:root {
  --ink: #0b0705;
  --gold-1: #fff3c4;
  --gold-2: #f2c55c;
  --gold-3: #b5832f;
  --gold-4: #6e4a17;
  --ember: #ff8a2a;
  --text: #efe4cf;
  --muted: #a8977c;
  --panel: rgba(16, 10, 7, .78);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* --- original sword cursor (tip = hotspot) --- */
html, body, #namebox, #stage, ruffle-player { cursor: url(assets/cursor-sword.svg) 2 2, auto; }
a, button, input[type=submit], [role=button] { cursor: url(assets/cursor-sword-hover.svg) 2 2, pointer; }
#namebox input { cursor: url(assets/cursor-sword.svg) 2 2, text; }

#namebox {
  position: fixed; inset: 0; z-index: 10; overflow: hidden;
  display: grid; place-items: center; background: var(--ink);
  font-family: 'Inter', system-ui, sans-serif; color: var(--text);
}

/* --- background: original art, two halves, slow drift --- */
#namebox .bg {
  position: absolute; inset: -3%;
  background: #0b0705 url(assets/launcher-bg.jpg) center 45% / cover no-repeat;
  background-image: image-set(url(assets/launcher-bg.webp) type('image/webp'), url(assets/launcher-bg.jpg) type('image/jpeg'));
  animation: drift 32s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.07) translate3d(0, -1%, 0); } }

#namebox .shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 75% at 50% 50%, rgba(11,7,5,0) 30%, rgba(11,7,5,.55) 75%, rgba(11,7,5,.9)),
    linear-gradient(to bottom, rgba(11,7,5,.35), transparent 22%, transparent 78%, rgba(11,7,5,.7));
}

/* --- embers (pure CSS) --- */
#namebox .embers { position: absolute; inset: 0; pointer-events: none; }
#namebox .embers span {
  position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%;
  background: radial-gradient(circle, #ffe2a8, var(--ember) 45%, transparent 70%);
  box-shadow: 0 0 10px 2px rgba(255,138,42,.55);
  opacity: 0; animation: rise linear infinite;
}
@keyframes rise {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0; }
  10% { opacity: .9; }
  100% { transform: translate3d(var(--dx, 30px), -105vh, 0) scale(.3); opacity: 0; }
}

/* --- card --- */
#namebox .card {
  position: relative; z-index: 2; width: min(440px, 90vw);
  padding: 40px 36px 28px; text-align: center;
  background: var(--panel); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border: 1px solid rgba(242,197,92,.55); border-radius: 4px;
  box-shadow: 0 0 0 6px rgba(11,7,5,.55), 0 0 0 7px rgba(181,131,47,.45), 0 40px 90px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,243,196,.08);
  animation: enter .9s var(--ease) both;
}
@keyframes enter { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
/* corner ornaments */
#namebox .card::before, #namebox .card::after, #namebox .card .c3, #namebox .card .c4 {
  content: ''; position: absolute; width: 22px; height: 22px; border: 2px solid var(--gold-2);
}
#namebox .card::before { top: -8px; left: -8px; border-right: 0; border-bottom: 0; }
#namebox .card::after { top: -8px; right: -8px; border-left: 0; border-bottom: 0; }
#namebox .card .c3 { bottom: -8px; left: -8px; border-right: 0; border-top: 0; }
#namebox .card .c4 { bottom: -8px; right: -8px; border-left: 0; border-top: 0; }

#namebox .emblem {
  width: 76px; height: 76px; margin: -78px auto 10px; border-radius: 50%;
  background: #120b06 url(../Resources/favicons/DR_favicon_128x128.png) center / 82% no-repeat;
  box-shadow: 0 0 0 2px var(--gold-3), 0 0 0 6px rgba(11,7,5,.9), 0 0 0 7px rgba(242,197,92,.5), 0 10px 30px rgba(0,0,0,.6);
}

#namebox h1 {
  margin: 0; font: 700 40px/1 'Cinzel', 'Trajan Pro', Georgia, serif; letter-spacing: .14em; text-transform: uppercase;
  background: linear-gradient(180deg, var(--gold-1) 0%, var(--gold-2) 45%, var(--gold-3) 70%, var(--gold-1) 100%);
  background-size: 100% 220%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)) drop-shadow(0 0 18px rgba(242,197,92,.18));
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%, 100% { background-position: 0 0; } 50% { background-position: 0 100%; } }
#namebox h1 small {
  display: block; margin-top: 8px; font: 600 13px/1 'Cinzel', Georgia, serif; letter-spacing: .62em; padding-left: .62em;
  -webkit-text-fill-color: var(--gold-2); color: var(--gold-2); opacity: .9;
}

#namebox .rule { display: flex; align-items: center; gap: 12px; margin: 22px 0 18px; color: var(--gold-3); }
#namebox .rule::before, #namebox .rule::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-3), transparent); }
#namebox .rule b { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid var(--gold-2); }

#namebox label { display: block; font: 600 11px/1 'Inter', sans-serif; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

#namebox input {
  width: 100%; box-sizing: border-box; padding: 15px 16px; text-align: center;
  font: 600 20px/1.2 'Inter', sans-serif; letter-spacing: .04em; color: var(--gold-1);
  background: rgba(0,0,0,.45); border: 1px solid rgba(181,131,47,.6); border-radius: 2px; outline: none;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
#namebox input::placeholder { color: #6f6150; font-weight: 500; letter-spacing: .02em; }
#namebox input:focus { border-color: var(--gold-2); background: rgba(0,0,0,.6); box-shadow: 0 0 0 3px rgba(242,197,92,.14), 0 0 24px rgba(242,197,92,.12); }
#namebox .hint { min-height: 18px; margin: 8px 0 0; font-size: 12px; color: #d77a5a; }

#namebox button {
  position: relative; width: 100%; margin-top: 14px; padding: 16px; cursor: pointer; overflow: hidden;
  font: 700 15px/1 'Cinzel', Georgia, serif; letter-spacing: .3em; text-transform: uppercase; color: #1a0f05;
  background: linear-gradient(180deg, #ffe9a6 0%, #f2c55c 40%, #c8923a 100%);
  border: 1px solid #ffe9a6; border-radius: 2px;
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 -2px 0 rgba(110,74,23,.45) inset, 0 10px 24px rgba(0,0,0,.45);
  transition: transform .15s var(--ease), filter .2s var(--ease), box-shadow .2s var(--ease);
}
#namebox button::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-20deg);
  animation: glint 4.5s ease-in-out infinite 1.2s;
}
@keyframes glint { 0%, 70% { left: -40%; } 100% { left: 130%; } }
#namebox button:hover { filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 -2px 0 rgba(110,74,23,.45) inset, 0 14px 32px rgba(0,0,0,.5), 0 0 26px rgba(242,197,92,.25); }
#namebox button:active { transform: translateY(1px); }

#namebox .foot { margin: 18px 0 0; font-size: 11px; letter-spacing: .08em; color: var(--muted); }
#namebox .or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; font: 600 10px/1 'Inter', sans-serif; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
#namebox .or::before, #namebox .or::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.12); }
#namebox .gbtn { display: flex; justify-content: center; min-height: 44px; }

/* boot status, styled to match */
#status {
  position: fixed; left: 50%; bottom: 7vh; transform: translateX(-50%); z-index: 5;
  font: 600 12px/1 'Cinzel', Georgia, serif; letter-spacing: .3em; text-transform: uppercase; color: var(--gold-2);
  opacity: .85; pointer-events: none; text-shadow: 0 2px 8px #000;
}
#status:empty { display: none; }

@media (max-width: 520px) {
  #namebox .card { padding: 36px 22px 24px; }
  #namebox h1 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  #namebox .bg, #namebox h1, #namebox button::after, #namebox .embers span { animation: none !important; }
  #namebox .embers { display: none; }
}
