/* Game styles (index.html). The editor uses editor-base.css instead. */
:root {
  --sun: #fde163;
  --ink: #141414;
  --cream: #fdf7e6;
  --peri: #97a6f7;
  --peri-deep: #7c8cf2;
  --peri-soft: #dfe3fd;
  --tomato: #fb5f3b;
  --muted: #6b6455;
  --accent: var(--tomato);
  --good: #3fb763;
  --bad: var(--tomato);
  --skip: #8d877a;
  --line: 3px solid var(--ink);
  --shadow: 6px 7px 0 var(--ink);
  --display: 'Lilita One', 'Arial Black', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--sun);
  color: var(--ink);
  font: 500 16px/1.45 Fredoka, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
svg { flex: none; }

/* ---------- header ---------- */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 24px 18px;
}
.logo { position: relative; display: flex; align-items: center; gap: 18px; padding-left: 26px; }
.logo h1 {
  margin: 0;
  font: 400 46px/1 var(--display);
  letter-spacing: .5px;
  color: var(--ink);
  transform: rotate(-4deg);
  -webkit-text-stroke: 7px var(--cream);
  paint-order: stroke fill;
  text-shadow: 5px 6px 0 var(--peri);
}
.logo-dashes { position: absolute; left: -4px; top: 50%; width: 22px; height: 30px; transform: translateY(-40%) scaleX(-1); color: var(--ink); }
.tagline {
  margin: 0;
  max-width: 150px;
  font: 400 18px/1.15 'Gochi Hand', cursive;
  text-transform: uppercase;
  letter-spacing: .06em;
  transform: rotate(-5deg);
}
.tagline::after { content: ''; display: block; width: 60px; height: 3px; margin-top: 5px; border-radius: 3px; background: var(--ink); }

.modes {
  display: flex;
  border: var(--line);
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 4px 6px 0 var(--ink);
  overflow: hidden;
}
.mode {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 24px;
  border: 0;
  background: none;
  font-weight: 600;
  font-size: 19px;
}
.mode + .mode { border-left: var(--line); }
.mode svg { width: 24px; height: 24px; }
.mode.active { background: var(--peri); }
.mode:not(.active):hover { background: var(--peri-soft); }

.tools { display: flex; justify-content: flex-end; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 2px 18px;
  border: 0;
  background: none;
  font-weight: 600;
  font-size: 16px;
}
.tool + .tool { border-left: var(--line); }
.tool svg { width: 32px; height: 32px; transition: transform .15s; }
.tool:hover svg { transform: translateY(-2px) rotate(-6deg); }

/* ---------- board ---------- */
.board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 28px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 24px 48px;
}
.card {
  position: relative;
  border: var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.stage-wrap, .panel-wrap { position: relative; }
.star { position: absolute; z-index: 3; pointer-events: none; stroke: var(--ink); stroke-width: 0; }
.star-cream { width: 74px; height: 74px; top: -22px; right: -26px; fill: var(--cream); transform: rotate(10deg); }
.star-red { width: 96px; height: 96px; bottom: 6px; left: -30px; fill: var(--tomato); transform: rotate(-8deg); }
.star-blue { width: 76px; height: 76px; bottom: -22px; right: -24px; fill: #6f8ff7; transform: rotate(14deg); }
.dashes { width: 26px; height: 32px; color: var(--peri-deep); vertical-align: middle; }

/* ---------- stage ---------- */
.stage {
  aspect-ratio: 7 / 6;
  overflow: hidden;
  background: var(--peri);
}
.stage canvas { display: block; width: 100%; height: 100%; }
.badge-row { position: absolute; left: 22px; top: 22px; display: flex; align-items: center; gap: 8px; z-index: 2; pointer-events: none; }
.badge {
  padding: 6px 22px;
  border: var(--line);
  border-radius: 999px;
  background: var(--cream);
  font: 600 20px/1.3 Fredoka, sans-serif;
  font-variant-numeric: tabular-nums;
}
.badge-row .dashes { color: var(--ink); }
.reveal-name {
  position: absolute; left: 50%; bottom: 22px;
  padding: 6px 22px;
  border: var(--line);
  border-radius: 999px;
  background: var(--cream);
  box-shadow: 4px 5px 0 var(--ink);
  font: 400 28px/1.2 var(--display);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 10px) rotate(-2deg);
  transition: opacity .8s ease .4s, transform .8s ease .4s;
  pointer-events: none;
}
.reveal-name.show { opacity: 1; transform: translate(-50%, 0) rotate(-2deg); }

/* ---------- panel ---------- */
.panel {
  padding: 34px 30px 40px;
  background: var(--cream);
}
.panel-title {
  margin: 0 0 22px;
  font: 400 34px/1.1 var(--display);
  text-align: center;
}
.guess.shake { animation: shake .4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.input-wrap { position: relative; }
#guess-input {
  width: 100%;
  height: 58px;
  padding: 0 20px;
  border: 3px solid #8d877a;
  border-radius: 14px;
  background: #fffdf5;
  color: var(--ink);
  font: 500 19px Fredoka, system-ui, sans-serif;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#guess-input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px var(--peri-soft); }
#guess-input::placeholder { color: #8d877a; }
#guess-input:disabled { opacity: .7; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  z-index: 5;
  margin: 0; padding: 6px;
  list-style: none;
  background: var(--cream);
  border: var(--line);
  border-radius: 14px;
  box-shadow: 4px 6px 0 var(--ink);
  display: none;
}
.suggest.open { display: block; }
.suggest li { padding: 8px 12px; border-radius: 9px; cursor: pointer; font-size: 17px; }
.suggest li.active, .suggest li:hover { background: var(--peri-soft); }
.suggest li.used { color: var(--muted); text-decoration: line-through; }
.suggest mark { background: none; color: var(--tomato); font-weight: 700; }
.suggest .via { color: var(--muted); }

.guess-actions { display: flex; gap: 18px; margin-top: 24px; }
.guess-actions .primary { flex: 1; }

.primary, .ghost {
  height: 58px;
  padding: 0 28px;
  border: var(--line);
  border-radius: 16px;
  box-shadow: 4px 6px 0 var(--ink);
  font: 400 26px/1 var(--display);
  letter-spacing: .02em;
  white-space: nowrap;
  transition: transform .08s, box-shadow .08s;
}
.primary { background: var(--tomato); color: #fff; }
.ghost { background: var(--peri); color: var(--ink); }
.primary:hover:not(:disabled), .ghost:hover:not(:disabled) { transform: translate(-1px, -2px); box-shadow: 5px 8px 0 var(--ink); }
.primary:active:not(:disabled), .ghost:active:not(:disabled) { transform: translate(3px, 5px); box-shadow: 1px 1px 0 var(--ink); }
.primary:disabled, .ghost:disabled { opacity: .5; box-shadow: 2px 3px 0 var(--ink); transform: translate(2px, 3px); }
.primary.big { height: 64px; padding: 0 36px; font-size: 28px; border-radius: 999px; }

.squiggle {
  height: 14px;
  margin: 34px 0 30px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='14' viewBox='0 0 32 14'%3E%3Cpath d='M0 7c4 0 4-4 8-4s4 4 8 4 4 4 8 4 4-4 8-4' fill='none' stroke='%23141414' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x center / 32px 14px;
}
.attempts-title { margin: 0 0 18px; font: 400 28px/1.1 var(--display); }

/* attempt squares */
.slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.slots li { display: grid; justify-items: center; gap: 6px; }
.slots .box {
  width: 100%;
  aspect-ratio: 1;
  display: grid; place-items: center;
  border: var(--line);
  border-radius: 12px;
  background: #fffdf5;
  font: 400 30px var(--display);
  color: #fff;
}
.slots .num { font-weight: 700; font-size: 17px; }
.slots .current .box { background: var(--peri-soft); border-style: dashed; }
.slots .wrong .box { background: var(--tomato); box-shadow: 3px 4px 0 var(--ink); }
.slots .skip .box { background: var(--skip); box-shadow: 3px 4px 0 var(--ink); }
.slots .right .box { background: var(--good); box-shadow: 3px 4px 0 var(--ink); }

/* named guesses */
.log { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 8px; }
.log:empty { display: none; }
.log li {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 14px 7px 8px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: #fffdf5;
  font-size: 17px;
}
.log .mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: #fff; font-weight: 700; font-size: 15px; }
.log .wrong .mark { background: var(--tomato); }
.log .skip .mark { background: var(--skip); }
.log .right { background: #e3f6e8; }
.log .right .mark { background: var(--good); }
.log .skip .name { color: var(--muted); }
.log .name { flex: 1; font-weight: 600; }
.log .at { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; top: 20px;
  transform: translate(-50%, -20px);
  padding: 10px 20px;
  border: var(--line);
  border-radius: 14px;
  background: var(--ink); color: var(--cream);
  font-weight: 600; font-size: 16px;
  box-shadow: 4px 5px 0 var(--peri-deep);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- dialogs ---------- */
.dlg {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  padding: 30px 28px 26px;
  border: var(--line);
  border-radius: 26px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 8px 10px 0 var(--ink);
}
.dlg::backdrop { background: rgba(20, 20, 20, .45); }
.dlg h2 { margin: 0 0 14px; font: 400 32px/1.1 var(--display); }
.dlg p { margin: 0 0 12px; }
.dlg .close {
  position: absolute; right: 14px; top: 14px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: var(--line); border-radius: 50%;
  background: var(--sun);
  font-size: 22px; line-height: 1; font-weight: 700;
}
.dlg .close:hover { background: var(--peri); }
.dlg > .primary { width: 100%; margin-top: 8px; }
.rules { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.rules li { display: flex; gap: 12px; }
.dot { flex: none; width: 14px; height: 14px; margin-top: 5px; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--c); }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.kicker { font: 400 19px/1.2 'Gochi Hand', cursive; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px !important; text-align: center; }
.res-name { text-align: center; font-size: 42px !important; margin-bottom: 6px !important; }
.res-line { text-align: center; }
.squares { text-align: center; font-size: 24px; letter-spacing: 4px; margin-bottom: 18px; }
.res-global { display: grid; gap: 2px; text-align: center; margin: -8px 0 16px; }
.res-global:empty { display: none; }
.res-global strong { font-weight: 600; }
.res-global span { font-size: 14px; color: var(--muted); }
.res-actions { display: flex; gap: 14px; margin-bottom: 14px; }
.res-actions button { flex: 1; min-width: 0; padding: 0 12px; font-size: 21px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 18px; text-align: center; }
.stats-grid > div { padding: 10px 2px 8px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fffdf5; }
.stats-grid .n { font: 400 30px/1.1 var(--display); }
.stats-grid .l { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.dist { display: grid; gap: 6px; margin-bottom: 10px; }
.dist-row { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.dist-bar { height: 24px; min-width: 28px; padding: 0 8px; border: 2.5px solid var(--ink); border-radius: 8px; background: var(--peri); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: flex-end; }
.dist-bar.hi { background: var(--tomato); color: #fff; }
.dist-bar.zero { background: none; border: 0; color: var(--muted); justify-content: flex-start; padding: 0; }
.dist-title { font: 400 22px/1.2 var(--display); margin: 0 0 10px; }

.dlg a { color: #3d4fd6; font-weight: 600; }
.credit { font-size: 13px; margin-top: -4px; }
.credits { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.credits strong { color: var(--ink); font-weight: 600; }

/* ---------- dev gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 16px; }
.gallery figure { margin: 0; text-align: center; font-size: 12px; }
.gallery img { width: 100%; border-radius: 8px; display: block; }

/* ---------- smaller screens ---------- */
@media (max-width: 980px) {
  .top { grid-template-columns: 1fr auto; row-gap: 18px; }
  .modes { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .board { grid-template-columns: 1fr; max-width: 640px; }
  .stage { aspect-ratio: 1 / 1; max-height: 64dvh; width: 100%; }
}
@media (max-width: 600px) {
  .top { padding: 18px 16px 12px; gap: 12px; }
  .logo { padding-left: 18px; gap: 12px; }
  .logo h1 { font-size: 34px; -webkit-text-stroke-width: 5px; text-shadow: 3px 4px 0 var(--peri); }
  .logo-dashes { width: 16px; height: 24px; }
  .tagline { display: none; }
  .tool { padding: 2px 10px; font-size: 13px; }
  .tool svg { width: 26px; height: 26px; }
  .mode { padding: 9px 18px; font-size: 17px; }
  .board { padding: 6px 16px 36px; gap: 22px; }
  .card { border-radius: 22px; box-shadow: 4px 5px 0 var(--ink); }
  .badge-row { left: 14px; top: 14px; }
  .badge { font-size: 16px; padding: 4px 16px; }
  .panel { padding: 24px 18px 28px; }
  .panel-title { font-size: 27px; margin-bottom: 16px; }
  .guess-actions { gap: 12px; margin-top: 16px; }
  .primary, .ghost { height: 54px; font-size: 23px; padding: 0 22px; }
  .squiggle { margin: 24px 0 20px; }
  .attempts-title { font-size: 23px; }
  .slots { gap: 8px; }
  .slots .box { font-size: 24px; border-radius: 10px; }
  .star-red, .star-blue, .star-cream { width: 50px; height: 50px; }
  .star-cream { top: -16px; right: -12px; }
  .star-red { left: -14px; bottom: 4px; }
  .star-blue { right: -12px; bottom: -16px; }
  .reveal-name { font-size: 22px; }
}
@media (max-width: 380px) {
  .tool span { display: none; }
}
