/* Shared look for every TNChatZone HTML5 game. Mobile first, dark, touch friendly. */
:root {
  --bg: #15121f;
  --bg2: #201b2e;
  --card: #2a2340;
  --line: #3a3155;
  --text: #f4f1fb;
  --muted: #a69fbf;
  --primary: #ff6b2c;
  --primary-2: #e64980;
  --gold: #ffc533;
  --ok: #3ddc84;
  --bad: #ff5c5c;
  --radius: 14px;
  --bar-h: 52px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 70% at 50% 0%, #2b1f45 0%, var(--bg) 60%);
  background-color: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* Top bar */
.tnz-bar {
  position: sticky; top: 0; z-index: 10;
  height: var(--bar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 12px; background: rgba(21, 18, 31, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tnz-bar h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tnz-icon { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--card); font-size: 18px; }
.tnz-coins { font-weight: 700; color: var(--gold); font-size: 15px; }

/* Main area */
.tnz-main { max-width: 480px; margin: 0 auto; padding: 14px 16px 24px; min-height: calc(100% - var(--bar-h)); display: flex; flex-direction: column; align-items: center; }
.tnz-stats { display: flex; gap: 8px; width: 100%; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.tnz-stat { background: var(--card); border-radius: 10px; padding: 6px 12px; text-align: center; min-width: 76px; }
.tnz-stat span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tnz-stat b { font-size: 18px; }
.tnz-hint { color: var(--muted); font-size: 14px; text-align: center; margin: 10px 0; }
canvas.tnz-canvas { display: block; width: 100%; max-width: 440px; border-radius: var(--radius); background: var(--bg2); touch-action: none; }

/* Buttons */
.tnz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-weight: 600; text-decoration: none; font-size: 16px;
}
.tnz-btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border: 0; color: #fff; }
.tnz-btn.gold { background: var(--gold); color: #2a1a00; border: 0; }
.tnz-btn.ghost { background: transparent; }
.tnz-btn:active { transform: scale(.97); }
.tnz-btn[disabled] { opacity: .5; }

/* Start screen used by most games */
.tnz-start { text-align: center; margin: auto 0; padding: 24px 0; }
.tnz-start .tnz-big { font-size: 72px; }
.tnz-start p { color: var(--muted); max-width: 320px; margin: 8px auto 20px; }

/* Result sheet */
.tnz-sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.tnz-sheet-wrap.show { opacity: 1; }
.tnz-sheet {
  width: 100%; max-width: 480px; max-height: 88vh; overflow: auto;
  background: var(--bg2); border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  text-align: center; transform: translateY(30px); transition: transform .25s;
}
.tnz-sheet-wrap.show .tnz-sheet { transform: none; }
.tnz-sheet h2 { margin: 6px 0; font-size: 22px; }
.tnz-sheet p { margin: 6px 0; color: var(--muted); }
.tnz-big { font-size: 56px; line-height: 1; }
.tnz-score { font-size: 18px; color: var(--text) !important; }
.tnz-coinline { font-weight: 700; color: var(--gold) !important; min-height: 22px; }
.tnz-coinline.win { font-size: 22px; animation: tnz-pop .5s ease; }
.tnz-btns { display: grid; gap: 10px; margin-top: 16px; }
.tnz-board { text-align: left; padding: 0; margin: 12px 0 0; list-style: none; }
.tnz-board li { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tnz-board li span { color: var(--muted); width: 32px; }
.tnz-board li b { margin-left: auto; color: var(--gold); }

/* Toast */
.tnz-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px); opacity: 0;
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: .25s; max-width: 90vw; text-align: center;
}
.tnz-toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes tnz-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes tnz-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tnz-shake { animation: tnz-shake .3s; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
