/* Centopia: ancient-map theme. Day = parchment, night (Hard mode) = blue tint over the same map. */
:root {
  --ink: #2E1F0F; --muted: #5C4528; --accent: #8A3B12; --on: #FFF4DD;
  --chip: rgba(46,31,15,.09); --panel: rgba(251,243,222,.9); --line: rgba(92,69,40,.35);
  --paper: #FBF3DE; --track: rgba(92,69,40,.18); --warn: #C2410C;
  --display: 'IM Fell English SC', Georgia, serif; --body: 'EB Garamond', Georgia, serif;
}
body.night {
  --ink: #F3E6C6; --muted: #D9C9A6; --accent: #E9C46A; --on: #1A1208;
  --chip: rgba(255,246,218,.12); --panel: rgba(20,24,52,.74); --line: rgba(243,230,198,.25); --track: rgba(243,230,198,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #2A1D10; font-family: var(--body); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #B4532A; outline-offset: 2px; }

#frame { position: relative; width: min(100vw, 460px); height: 100dvh; margin: 0 auto; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #F3E6C6 0%, #E6D1A3 70%, #CDB07A 100%);
  box-shadow: 0 0 60px rgba(0,0,0,.5); }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#veil { position: absolute; inset: 0; background: rgba(243,230,198,.5); pointer-events: none; opacity: 0; transition: opacity .6s ease; }
body.in-game #veil { opacity: 1; }
#night { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
body.night #night { opacity: 1; }
#sky { position: absolute; right: 40px; top: 70px; width: 52px; height: 52px; pointer-events: none; }
#sky .orb { position: absolute; inset: 0; border-radius: 50%; transition: background 1.2s ease, box-shadow 1.2s ease, transform 1.2s ease;
  background: #F2C14E; box-shadow: inset 0 0 0 2px #5C4528, 0 0 40px 12px rgba(242,180,70,.45); }
body.night #sky .orb { background: transparent; transform: rotate(-20deg); box-shadow: inset -15px 8px 0 0 #F6EBC8, 0 0 36px 6px rgba(246,235,200,.2); }
#sky .rays { position: absolute; left: -22px; top: -22px; transition: opacity 1s ease, transform 1.2s ease; }
body.night #sky .rays { opacity: 0; transform: scale(.4); }
body.in-game #sky { top: 92px; opacity: .9; }

#app { position: relative; height: 100%; display: flex; flex-direction: column; padding: 18px 20px 24px; gap: 14px; transition: color .8s ease; }

/* shared pieces */
.chip { background: var(--chip); color: var(--ink); border-radius: 999px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .8s ease, color .8s ease; }
.icon-btn { width: 44px; height: 44px; border: none; display: flex; align-items: center; justify-content: center; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.panel { border-radius: 16px; padding: 14px 16px; background: var(--panel); color: var(--ink); border: 1.5px solid var(--line);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .8s ease, color .8s ease; }
.label { font-size: 13px; letter-spacing: 2.5px; font-weight: 700; opacity: .85; }
.display { font-family: var(--display); font-weight: 400; }
.cta { height: 62px; border-radius: 16px; border: 2px solid #5C4528; background: var(--accent); color: var(--on);
  font-family: var(--display); font-size: 22px; letter-spacing: 2px; box-shadow: 0 10px 24px rgba(0,0,0,.22);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  transition: transform .15s ease, background .8s ease, color .8s ease; }
body.night .cta { border-color: #F6E7C2; }
.cta:hover:not(:disabled) { transform: translateY(-2px); }
.cta:active:not(:disabled) { transform: scale(.97); }
.cta.pulse { animation: breathe 2.6s ease-in-out 1.5s infinite; }
.ghost { height: 62px; border-radius: 16px; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); font-size: 18px; font-weight: 700; transition: transform .15s ease; }
.ghost:hover { transform: translateY(-2px); }
.scroll { position: relative; background: var(--paper); color: #2E1F0F; border: 2px solid #5C4528; border-radius: 6px; padding: 26px 22px 30px;
  box-shadow: 0 0 0 6px rgba(251,243,222,.6), 0 18px 40px rgba(46,31,15,.3); transform-origin: top; animation: unroll .8s cubic-bezier(.2,.8,.3,1) both; }
.seal { position: absolute; right: 18px; bottom: -22px; width: 62px; height: 62px; border-radius: 50%; background: #8A3B12; color: #F6E7C2;
  display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 20px; box-shadow: 0 4px 0 #5E2A0E;
  animation: stamp .7s cubic-bezier(.2,.9,.3,1.2) .6s both; }
.stamp { display: inline-block; margin-top: 14px; padding: 8px 18px; border-radius: 8px; border: 3px solid #8A3B12; color: #8A3B12; background: var(--paper);
  font-family: var(--display); font-size: 24px; letter-spacing: 1px; animation: stamp .7s cubic-bezier(.2,.9,.3,1.2) 1.2s both; }
.screen { flex: 1; display: flex; flex-direction: column; gap: 14px; min-height: 0; animation: screenin .55s cubic-bezier(.2,.8,.3,1) both; }
.scrollable { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 2px; }
.muted { color: var(--muted); transition: color .8s ease; }
.shadowed { text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* title */
.logo { display: block; width: min(338px, 86%); height: auto; margin: 0 auto; filter: drop-shadow(0 8px 14px rgba(46,31,15,.25)); transition: filter .8s ease; }
body.night .logo { filter: drop-shadow(0 0 18px rgba(233,196,106,.55)) brightness(.95); }
.toggle { display: flex; gap: 6px; padding: 5px; }
.toggle button { flex: 1; height: 44px; border-radius: 999px; border: none; background: transparent; font-size: 14px; font-weight: 600; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: background .5s ease, color .5s ease; }
.toggle button[aria-pressed="true"] { background: var(--accent); color: var(--on); font-weight: 700; }
.toggle button:disabled:not([aria-pressed="true"]) { opacity: .45; }

/* guess */
.field { width: 100%; height: 58px; border-radius: 14px; border: 2px solid #5C4528; background: var(--paper); color: #2E1F0F; padding: 0 16px; font-size: 21px; }
.dots { display: flex; gap: 8px; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent); background: var(--accent); transition: all .5s ease; }
.dot.used { background: transparent; transform: scale(.8); }
.timebar { flex: 1; height: 12px; border-radius: 6px; background: var(--track); overflow: hidden; }
.timebar > div { height: 100%; border-radius: 6px; background: var(--accent); transition: width 1s linear, background .4s ease; }
.low .timebar > div { background: var(--warn); }
.timetext { width: 46px; text-align: right; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.low .timetext { color: var(--warn); }
.low #hourglass { animation: shake .5s ease infinite; }
#sandTop { transition: y 1s linear; }
.suggest { border-radius: 16px; background: var(--paper); border: 2px dashed #8A3B12; padding: 14px 16px; color: #2E1F0F; animation: screenin .35s ease both; }
.suggest button { flex: 1; height: 46px; border-radius: 12px; font-size: 16px; font-weight: 700; }

/* strike */
.fog { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 45%, rgba(240,236,226,.15), rgba(200,196,186,.88) 75%); animation: fogin 1s ease both; }

/* result trail */
.trail { position: relative; height: 40px; margin-top: 8px; }
.trail .path { position: absolute; left: 0; right: 0; top: 22px; border-top: 3px dashed currentColor; opacity: .45; }
.trail .zone { position: absolute; top: 20px; height: 7px; border-radius: 4px; opacity: .85; }
.pin { position: absolute; top: 0; transition: left 1.5s cubic-bezier(.4,0,.2,1), opacity .4s ease; }
.pin > div { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #8A3B12; border: 2px solid var(--paper);
  display: flex; align-items: center; justify-content: center; }
.pin span { transform: rotate(45deg); color: var(--paper); font-weight: 700; font-size: 13px; }
.tiers { display: flex; justify-content: space-between; font-size: 12px; margin-top: 6px; opacity: .85; }

/* list */
.listbox { flex: 1; min-height: 0; overflow-y: auto; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--line); }
.lrow { display: flex; align-items: center; gap: 6px; padding: 9px 12px; font-size: 16px; border-bottom: 1px solid var(--line); animation: rowin .4s ease both; }
.lrow.mine { background: #8A3B12; color: #FFF4DD; font-weight: 700; }
.lrow.top { background: rgba(233,196,106,.45); }
.lhead { position: sticky; top: 0; z-index: 1; padding: 8px 12px; font-family: var(--display); font-size: 16px; letter-spacing: 1px; background: #EAD7AE; color: #2E1F0F; }
body.night .lhead { background: #1C2147; color: #F3E6C6; }

/* summary */
.qrow { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); animation: rowin .45s ease both; }
.qrow:last-child { border-bottom: none; }
.num { width: 26px; height: 26px; border-radius: 50%; background: #8A3B12; color: var(--paper); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.ellip { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark { position: absolute; width: 18px; height: 18px; }

/* modal */
.modal { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(30,20,8,.55); animation: dim .3s ease both; }
.modal .scroll { width: 100%; max-height: 100%; overflow-y: auto; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 14px; }
.stats div { text-align: center; padding: 10px; border-radius: 12px; background: rgba(92,69,40,.08); }
.stats b { display: block; font-size: 28px; }

@keyframes tw { 0%,100% { opacity: .15 } 50% { opacity: 1 } }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@keyframes bobw { 0%,100% { transform: translateX(0) } 50% { transform: translateX(4px) } }
@keyframes dash { to { stroke-dashoffset: -130 } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes pop { 0%,100% { transform: scale(.5); opacity: .3 } 50% { transform: scale(1.15); opacity: 1 } }
@keyframes cloud { from { transform: translateX(-120px) } to { transform: translateX(560px) } }
@keyframes fly { 0%,100% { transform: translate(0,0) } 25% { transform: translate(12px,-16px) } 50% { transform: translate(-8px,-26px) } 75% { transform: translate(-14px,-8px) } }
@keyframes glowp { 0%,100% { opacity: .55; transform: scale(1) } 50% { opacity: 1; transform: scale(1.15) } }
@keyframes inUp { from { opacity: 0; transform: translateY(28px) } to { opacity: 1; transform: none } }
@keyframes inDrop { 0% { opacity: 0; transform: translateY(-70px) scale(.7) } 70% { opacity: 1; transform: translateY(8px) scale(1.04) } 100% { transform: none } }
@keyframes breathe { 0%,100% { transform: scale(1) } 50% { transform: scale(1.035) } }
@keyframes unroll { from { transform: scaleY(0); opacity: 0 } to { transform: scaleY(1); opacity: 1 } }
@keyframes stamp { 0% { transform: scale(2.6) rotate(-18deg); opacity: 0 } 60% { transform: scale(.92) rotate(-6deg); opacity: 1 } 100% { transform: scale(1) rotate(-6deg); opacity: 1 } }
@keyframes shake { 0%,100% { transform: translateX(0) } 20% { transform: translateX(-8px) } 40% { transform: translateX(7px) } 60% { transform: translateX(-5px) } 80% { transform: translateX(3px) } }
@keyframes fogin { from { opacity: 0; filter: blur(12px) } to { opacity: 1; filter: blur(0) } }
@keyframes screenin { from { opacity: 0; transform: translateY(22px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes rowin { from { opacity: 0; transform: translateX(-14px) } to { opacity: 1; transform: none } }
@keyframes dim { from { opacity: 0 } to { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.cta, .ghost { white-space: nowrap; }
.row > .cta, .row > .ghost { font-size: 19px; letter-spacing: 1px; min-width: 0; }

/* Computers: the wide map around the game */
#desk { display: none; }
@media (min-width: 600px) {
  body { background: #CDB07A; }
  #desk { display: block; position: fixed; inset: 0; overflow: hidden;
    background: radial-gradient(ellipse at 50% 45%, #F3E6C6 0%, #E6D1A3 60%, #C9A872 100%); }
  .desk-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
  #desk-night { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s ease; }
  body.night #desk-night { opacity: 1; }
  #frame { height: min(100dvh - 32px, 900px); margin-top: max(16px, calc((100dvh - 900px) / 2));
    border-radius: 18px; border: 2.5px solid #5C4528;
    box-shadow: 0 0 0 7px rgba(251,243,222,.75), 0 0 0 9px rgba(92,69,40,.45), 0 30px 70px rgba(46,31,15,.45); }
}
