* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2a36;
}
body { display: flex; flex-direction: column; min-height: 100vh; }

header.site {
  padding: 12px 24px;
  background: #2b87d1;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
header.site a.home {
  color: #fff;
  text-decoration: none;
  opacity: 0.85;
  font-size: 14px;
}
header.site a.home:hover { opacity: 1; text-decoration: underline; }
header.site h1 { font-size: 18px; font-weight: 600; }
header.site p.sub { font-size: 13px; opacity: 0.85; margin-left: auto; }
@media (max-width: 480px) {
  header.site p.sub { display: none; }
}

/* Shared: starting-level input shown on level-based games' intro screens.
   Designed to sit on top of a colored game background (white text/outline). */
.start-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.start-input {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 12px;
  opacity: 0.85;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: inherit;
}
.start-input input {
  width: 110px;
  margin-top: 6px;
  padding: 10px 12px;
  font-size: 20px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  outline: none;
  letter-spacing: normal;
}
.start-input input:focus { border-color: #fff; background: rgba(255,255,255,0.18); }
.start-input input::-webkit-outer-spin-button,
.start-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Shared: persistent scoreboard panel below the game area. */
aside.scoreboard {
  background: #f4f6f8;
  border-top: 1px solid #e1e5ea;
  padding: 16px 24px 24px;
  display: none;
  color: #1f2a36;
  flex-shrink: 0;
}
aside.scoreboard.visible { display: block; }
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto 10px;
}
.board-head h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #5b6776;
  font-weight: 700;
}
button.link {
  background: none;
  border: none;
  color: #5b6776;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
}
button.link:hover { color: #1f2a36; }
aside.scoreboard table {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e1e5ea;
}
aside.scoreboard th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: #5b6776;
  border-bottom: 1px solid #e1e5ea;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: #fafbfc;
}
aside.scoreboard td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f3f5;
}
aside.scoreboard tr:last-child td { border-bottom: none; }
aside.scoreboard tr.best td { background: #fff8db; font-weight: 600; }
aside.scoreboard tr.best td:first-child::before { content: "★ "; color: #d4a017; }
aside.scoreboard .when { color: #8895a4; font-size: 13px; }
