* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: #14141c; color: #f2f2f2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button { font-family: inherit; }
#topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: #16161f;
  padding: 8px 12px calc(8px + env(safe-area-inset-top, 0px)); padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid #2a2a3a; }
.topline { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: nowrap; }
.brand { font-family: "Press Start 2P", monospace; font-weight: 400; letter-spacing: 0; font-size: 13px; white-space: nowrap; display: flex; align-items: center; }
.brand span { color: #ffd635; }
.capicon { flex: 0 0 auto; margin-right: 7px; }
.sealbadge { display: none; font-size: 11px; font-weight: 700; background: #23233a; color: #b9b9c9;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid #33334d; }
.dayspill { font-size: 11px; font-weight: 800; background: #ff9f2e; color: #14141c;
  padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.dayspill.done { background: #7eed56; }
.progressrow { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.progress { flex: 1; height: 6px; background: #2a2a3a; border-radius: 999px; overflow: hidden; }
.bar { height: 100%; width: 0%; background: linear-gradient(90deg, #7c3aed, #d946ef); transition: width .4s; }
.count { font-size: 11px; color: #b9b9c9; white-space: nowrap; }
#stage { position: fixed; top: 74px; bottom: 148px; left: 0; right: 0; }
#board { width: 100%; height: 100%; display: block; touch-action: none; background: #20202f;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: crosshair; }
.hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px;
  background: rgba(0,0,0,.65); padding: 6px 12px; border-radius: 999px; font-size: 12px;
  pointer-events: none; white-space: nowrap; }
#toolbar { position: fixed; left: 0; right: 0; bottom: 104px; z-index: 20; display: flex;
  gap: 4px; padding: 6px 8px; overflow-x: auto; background: #16161f; border-top: 1px solid #2a2a3a; align-items: center; }
.tbtn { flex: 0 0 auto; background: #23233a; color: #f2f2f2; border: 1px solid #33334d;
  border-radius: 999px; padding: 7px 11px; font-size: 13px; font-weight: 600; }
.tbtn.active { background: #ffd635; color: #14141c; border-color: #ffd635; }
.zoompct { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: #b9b9c9; padding: 0 4px; }
#paletteWrap { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #16161f;
  border-top: 1px solid #2a2a3a; padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
#cooldown { font-size: 12px; color: #b9b9c9; text-align: center; margin-bottom: 6px; min-height: 16px; }
#cooldown.hot { display: table; margin: 0 auto 6px; background: #ff9f2e; color: #14141c;
  font-weight: 800; padding: 4px 14px; border-radius: 999px; }
.palrow { display: flex; align-items: center; gap: 10px; }
.colorslabel { display: none; font-size: 12px; font-weight: 800; letter-spacing: 1px; color: #b9b9c9; flex: 0 0 auto; }
#palette { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; flex: 1; }
.swatch { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px; border: 2px solid #33334d; padding: 0; }
.swatch.sel { border-color: #fff; transform: scale(1.12); }
#livePanel { display: none; }
.sheet { display: none; position: fixed; left: 8px; right: 8px; bottom: 158px; z-index: 40;
  background: #23233a; border: 1px solid #33334d; border-radius: 16px; padding: 16px;
  max-height: 52vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,.6); }
.sheet.open { display: block; }
.sheet h2 { margin: 0 0 8px; font-size: 19px; }
.sheet h3 { margin: 16px 0 6px; font-size: 15px; }
.sheet p { font-size: 14px; line-height: 1.5; color: #d5d5e2; }
.sheet .empty { color: #8a8a9e; }
.big { display: block; width: 100%; background: #ffd635; color: #14141c; border: none;
  border-radius: 12px; padding: 13px; font-size: 16px; font-weight: 800; margin-top: 10px; }
.big.ghost { background: #23233a; color: #f2f2f2; }
.big.reason { background: #23233a; color: #f2f2f2; }
#userInput { width: 100%; background: #0e0e15; color: #fff; border: 1px solid #33334d;
  border-radius: 12px; padding: 13px; font-size: 16px; }
.feeditem { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #2a2a3a; font-size: 13px; }
.dot { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; border: 1px solid #555; }
.feeditem .who { font-weight: 700; }
.feeditem .when { margin-left: auto; color: #8a8a9e; font-size: 11px; white-space: nowrap; }
#tlCanvas { width: 100%; max-width: 340px; aspect-ratio: 1; background: #14141c; border-radius: 12px; display: block; margin: 0 auto; }
.tlrow { display: flex; align-items: center; gap: 10px; }
.tlrow .big { margin-top: 0; }
#tlStatus { font-size: 12px; color: #b9b9c9; white-space: nowrap; }
#toast { display: none; position: fixed; left: 50%; transform: translateX(-50%); bottom: 168px; z-index: 50;
  background: #f2f2f2; color: #14141c; font-weight: 700; font-size: 13px; padding: 9px 16px;
  border-radius: 999px; box-shadow: 0 4px 24px rgba(0,0,0,.5); max-width: 92vw; text-align: center; }
#toast.show { display: block; }
@media (min-width: 700px) {
  #stage { top: 78px; bottom: 152px; }
  .brand { font-size: 16px; }
  .sealbadge { display: block; }
  .sheet { left: auto; right: 16px; width: 380px; }
}
@media (min-width: 1000px) {
  #stage { right: 300px; }
  #livePanel { display: block; position: fixed; top: 78px; bottom: 152px; right: 0; width: 300px; z-index: 15;
    background: #16161f; border-left: 1px solid #2a2a3a; padding: 12px; overflow-y: auto; }
  .livehead { font-size: 14px; font-weight: 800; letter-spacing: 1px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
  .livedot { width: 9px; height: 9px; border-radius: 50%; background: #7eed56; animation: pulse 1.6s infinite; }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
  .colorslabel { display: block; }
  .sheet { right: 316px; }
}
