* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: #0e131d;
  color: #e8edf7;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
.hidden { display: none !important; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
#menu, #room { overflow-y: auto; }

/* ---------- menu ---------- */
#menu { align-items: center; justify-content: center; padding: 24px; gap: 14px; }
.logo svg { display: block; }
h1 { margin: 0; font-size: 32px; letter-spacing: 3px; }
.tagline { margin: 0 0 10px; color: #8fa0c0; font-size: 14px; }
#difficulty { display: flex; gap: 4px; background: #1a2336; padding: 4px; border-radius: 999px; margin-bottom: 8px; }
#difficulty button { border: 0; background: transparent; color: #8fa0c0; padding: 8px 18px; border-radius: 999px; font-size: 13px; cursor: pointer; }
#difficulty button.on { background: #2b3a5c; color: #fff; font-weight: 600; }
.big {
  width: 100%; max-width: 360px; border: 0; border-radius: 14px; padding: 16px;
  font-size: 17px; font-weight: 700; color: #0e131d; cursor: pointer;
  background: linear-gradient(180deg, #6db3ff, #3f8cf0);
}
.big.alt { background: linear-gradient(180deg, #ff9d8a, #f06a58); }
.big:active { transform: scale(0.98); }
.howto { width: 100%; max-width: 360px; color: #8fa0c0; font-size: 13px; line-height: 1.55; }
.howto summary { cursor: pointer; padding: 6px 0; font-weight: 600; color: #aeb9d4; }
.howto ul { margin: 8px 0; padding-left: 18px; }
.howto b { color: #e8edf7; }

/* ---------- room ---------- */
#room { align-items: center; justify-content: center; padding: 24px; }
.roombox {
  width: 100%; max-width: 380px; background: #151d2e; border: 1px solid #26314d;
  border-radius: 18px; padding: 24px; display: flex; flex-direction: column;
  gap: 14px; align-items: center; text-align: center;
}
.roombox h2 { margin: 0; font-size: 20px; }
.waitrow { display: flex; align-items: center; gap: 10px; color: #8fa0c0; font-size: 14px; }
.spinner {
  width: 22px; height: 22px; flex: none;
  border: 3px solid #2b3a5c; border-top-color: #6db3ff;
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.linkbox { width: 100%; }
.linkbox input {
  width: 100%; background: #0e131d; border: 1px solid #26314d; color: #e8edf7;
  border-radius: 10px; padding: 12px; font-size: 13px;
}
.row { display: flex; gap: 10px; width: 100%; }
.row button {
  flex: 1; border: 0; border-radius: 12px; padding: 13px; font-size: 15px;
  font-weight: 700; background: #2b3a5c; color: #fff; cursor: pointer;
}
#btnRoomBack { width: 100%; background: transparent; border: 1px solid #26314d; color: #8fa0c0; border-radius: 12px; padding: 13px; cursor: pointer; }

/* ---------- game ---------- */
#game header { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.icon { border: 0; background: #1a2336; color: #e8edf7; width: 40px; height: 40px; border-radius: 12px; font-size: 18px; cursor: pointer; flex: none; }
.hud { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; }
.chip { display: flex; align-items: center; gap: 6px; background: #1a2336; border-radius: 999px; padding: 5px 10px; font-weight: 700; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.status {
  font-size: 12px; font-weight: 600; text-align: center; color: #aeb9d4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw;
}
.status.good { color: #7ee787; }
.status.bad { color: #ff7b72; }
#boardWrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px; }
#board { touch-action: none; }
#hint { text-align: center; font-size: 12px; color: #64739a; padding: 6px 14px 10px; min-height: 22px; }

/* ---------- overlay & banner ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(6, 9, 15, 0.72);
  display: flex; align-items: center; justify-content: center;
}
#overlay .card {
  background: #151d2e; border: 1px solid #26314d; border-radius: 20px;
  padding: 28px 32px; text-align: center; width: 90%; max-width: 320px;
}
#ovTitle { margin: 0 0 6px; font-size: 26px; }
#ovSub { color: #8fa0c0; margin: 0 0 18px; font-size: 16px; }
#ovActions { display: flex; flex-direction: column; gap: 10px; }
.ovbtn {
  border: 0; border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 700;
  background: linear-gradient(180deg, #6db3ff, #3f8cf0); color: #0e131d; cursor: pointer;
}
.ovbtn:disabled { opacity: 0.6; }
#banner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  background: #26314d; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 20; opacity: 0; transition: opacity 0.25s;
  pointer-events: none; max-width: 90vw; text-align: center;
}
#banner.show { opacity: 1; }
