* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: var(--tg-theme-bg-color, #0b1220);
  --card: var(--tg-theme-secondary-bg-color, #151f31);
  --text: var(--tg-theme-text-color, #f8fafc);
  --muted: var(--tg-theme-hint-color, #94a3b8);
  --accent: var(--tg-theme-button-color, #4f7cff);
  --danger: #ef4444;
  --ok: #22c55e;
  --border: rgba(255,255,255,.09);
}
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 20% 0%, rgba(79,124,255,.16), transparent 35%), var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow-x: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 960px; margin: 0 auto; padding: 12px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0 14px; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; }
.brand-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, #4f7cff, #8b5cf6); box-shadow: 0 10px 28px rgba(79,124,255,.25); }
.status-pill { border: 1px solid var(--border); padding: 8px 11px; border-radius: 999px; font-size: 12px; color: var(--muted); background: rgba(255,255,255,.04); }
.card { border: 1px solid var(--border); background: rgba(255,255,255,.055); border-radius: 20px; box-shadow: 0 18px 50px rgba(0,0,0,.18); }
.word-card { padding: 14px 16px; margin-bottom: 12px; text-align: center; }
.label { color: var(--muted); font-size: 10px; letter-spacing: 1.6px; font-weight: 900; }
.word { margin-top: 4px; font-size: 30px; line-height: 1.1; font-weight: 950; }
.meta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.badge { font-size: 11px; border: 1px solid var(--border); padding: 6px 9px; border-radius: 999px; background: rgba(255,255,255,.04); color: var(--muted); }
.badge.chaos { color: #fbbf24; border-color: rgba(251,191,36,.28); background: rgba(251,191,36,.08); }
.canvas-card { padding: 8px; }
.canvas-wrap { position: relative; border-radius: 16px; overflow: hidden; background: #fff; }
#canvas { display: block; width: 100%; height: auto; touch-action: none; background: #fff; }
.lock-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(15,23,42,.68); backdrop-filter: blur(4px); color: white; text-align: center; padding: 24px; }
.lock-overlay.show { display: flex; }
.lock-box { max-width: 300px; }
.lock-title { font-size: 26px; font-weight: 950; }
.lock-text { margin-top: 6px; opacity: .85; font-size: 13px; }
.toolbar { display: grid; gap: 10px; margin-top: 10px; padding: 12px; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tool-btn { min-width: 44px; height: 44px; padding: 0 12px; border: 0; border-radius: 12px; color: var(--text); background: rgba(255,255,255,.075); }
.tool-btn.active { background: var(--accent); color: white; }
.tool-btn.danger { background: rgba(239,68,68,.14); color: #fecaca; }
.tool-btn:disabled { opacity: .38; cursor: not-allowed; }
.color { width: 30px; height: 30px; border-radius: 999px; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.size-wrap { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.size-wrap input { width: 150px; }
.info { padding: 10px 2px; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.info strong { color: var(--text); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: rgba(15,23,42,.92); color: #fff; border: 1px solid rgba(255,255,255,.12); padding: 10px 14px; border-radius: 12px; font-size: 12px; transition: .2s ease; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.admin-card { padding: 14px; }
.admin-card h2 { margin: 0 0 12px; font-size: 15px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.switch { position: relative; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #334155; border-radius: 999px; transition: .18s; }
.slider:before { content:""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: .18s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(20px); }
.field { display: grid; gap: 5px; margin: 10px 0; }
.field label { font-size: 11px; color: var(--muted); }
.field input { width: 100%; color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 10px; padding: 10px; outline: none; }
.primary-btn { border: 0; border-radius: 12px; padding: 11px 14px; background: var(--accent); color: white; font-weight: 800; }
.danger-btn { border: 0; border-radius: 12px; padding: 11px 14px; background: rgba(239,68,68,.16); color: #fecaca; font-weight: 800; }
.list { display: grid; gap: 7px; max-height: 360px; overflow: auto; }
.list-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 9px 10px; border: 1px solid var(--border); border-radius: 11px; background: rgba(255,255,255,.035); }
.list-item small { color: var(--muted); }
@media (max-width: 720px) { .admin-grid { grid-template-columns: 1fr; } .info { flex-direction: column; } }
