:root {
  --ink: #1d2835;
  --muted: #6b7280;
  --panel: #f7f7f5;
  --card: #ffffff;
  --rule: #e4e4e0;
  --accent: #fccc0a;
  --danger: #b91c1c;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--panel); }
.muted { color: var(--muted); }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

#game { display: flex; height: 100vh; height: 100dvh; }
#map-pane { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #e9e9e6; }

/* Search box, floating over the map like the original. */
#search {
  position: absolute; top: 1rem; left: 50%; transform: translateX(-50%);
  width: min(26rem, calc(100% - 2rem)); z-index: 2;
}
#search-row { position: relative; display: flex; gap: 0.5rem; }
#input-wrap { position: relative; flex: 1; }
#guess {
  width: 100%; height: 2.75rem; padding: 0 1.1rem; border: 0; border-radius: 999px;
  font: 700 1.1rem var(--font); color: var(--ink); background: var(--card);
  box-shadow: var(--shadow); outline: none; transition: box-shadow 0.25s;
}
#guess:focus-visible { box-shadow: var(--shadow), 0 0 0 2px var(--ink); }
#guess.success { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
#guess.wrong { animation: shake 0.4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
#already {
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
  padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  color: #166534; background: #bbf7d0; pointer-events: none;
}

.round {
  flex: none; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 999px;
  display: grid; place-items: center; background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.card { background: var(--card); border-radius: 0.75rem; box-shadow: var(--shadow); }
#menu {
  position: absolute; right: 0; top: 3.25rem; min-width: 15rem; padding: 0.4rem; display: flex; flex-direction: column;
}
#menu > * {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; border: 0;
  border-radius: 0.5rem; background: none; color: inherit; text-align: left; font-size: 0.95rem; cursor: pointer;
}
#menu > *:hover { background: var(--panel); }
#menu .danger { color: var(--danger); }

#mobile-summary { display: none; margin-bottom: 0.5rem; padding: 0.5rem 1rem; justify-content: space-between; align-items: baseline; gap: 0.5rem; font-size: 0.85rem; white-space: nowrap; }
#mobile-summary .score b { font-size: 1.4rem; }

#toast {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); z-index: 2;
  padding: 0.7rem 1.2rem; border-radius: 999px; background: var(--ink); color: #fff;
  font-weight: 700; box-shadow: var(--shadow); white-space: nowrap;
}

/* Sidebar */
#sidebar {
  width: 24rem; flex: none; overflow-y: auto; padding: 1.5rem; background: var(--panel);
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.08); z-index: 3;
}
h1 { margin: 0 0 1rem; font-size: 1.6rem; letter-spacing: -0.02em; }
h1 span { font-weight: 400; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.score { margin: 0; }
.score b { font-size: 2.2rem; letter-spacing: -0.03em; }
header p { margin: 0.2rem 0; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 1.25rem 0; }

.bullet {
  flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  font: 700 0.95rem/1 var(--font); background: var(--c); color: var(--t);
}
.bullet.sm { width: 1.25rem; height: 1.25rem; font-size: 0.75rem; }

#lines { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
#lines li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
#lines .bar { flex: 1; height: 0.4rem; border-radius: 999px; background: var(--rule); overflow: hidden; }
#lines .bar > i { display: block; height: 100%; width: var(--p); background: var(--c); transition: width 0.4s; }
#lines .n { width: 3.2rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
#lines li.done .n { color: var(--ink); font-weight: 700; }

#found { list-style: none; margin: 0; padding: 0; }
#found li button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.45rem 0.5rem; border: 0; border-radius: 0.4rem; background: none; color: inherit; text-align: left;
}
#found li button:hover, #found li button.hovered { background: #fef3c7; }
#found .name { font-weight: 600; }
#found .bullets { display: flex; gap: 0.15rem; flex-wrap: wrap; justify-content: flex-end; }
#empty { margin: 0; }

dialog {
  width: min(28rem, calc(100% - 2rem)); border: 0; border-radius: 1rem; padding: 1.5rem;
  color: var(--ink); background: var(--card); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(29, 40, 53, 0.45); }
dialog h2 { font-size: 1.4rem; }
dialog p { line-height: 1.5; }
dialog form { margin-top: 1.25rem; text-align: right; }
kbd { padding: 0.05rem 0.35rem; border: 1px solid var(--rule); border-radius: 0.3rem; background: var(--panel); }
.primary { padding: 0.6rem 1.3rem; border: 0; border-radius: 999px; font-weight: 700; background: var(--ink); color: #fff; }

@media (max-width: 800px) {
  #game { flex-direction: column; }
  #map-pane { flex: 1 1 60%; }
  #sidebar { width: auto; flex: 1 1 40%; padding: 1rem; box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08); }
  #sidebar header { display: none; }
  #lines { margin-top: 0; }
  #mobile-summary { display: flex; }
}

/* "Hide station names" also blurs the found list, for a harder game. */
.hide-names #found .name { filter: blur(5px); }
.hide-names #found li button:hover .name { filter: none; }
