:root {
  --bg: #0c1227;
  --bg2: #111a38;
  --card: #16204a;
  --line: #2a3a75;
  --text: #eef2ff;
  --muted: #9fb0dd;
  --dot: #54d8f5;
  --brass: #e8a33d;
  --brass2: #b97a1e;
  --danger: #ff7a7a;
  --ok: #7be3a8;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #1a2a5e 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.app-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; max-width: 640px; margin: 0 auto;
}
.logo { border-radius: 12px; }
.titles { flex: 1; min-width: 0; }
.titles h1 { margin: 0; font-size: 22px; letter-spacing: .3px; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.wallet {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 8px 6px 14px;
}
.wallet-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.wallet-balance { font-weight: 800; font-size: 18px; color: var(--brass); }
main { max-width: 640px; margin: 0 auto; padding: 0 16px 24px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 10px; font-size: 18px; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.45; }
.hint.small { font-size: 12.5px; }
label { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
input[type="text"], input[type="password"], textarea {
  display: block; width: 100%; margin-top: 6px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 16px; font-family: inherit;
}
textarea { resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: space-between; margin-top: 14px; }
.primary-btn {
  background: linear-gradient(180deg, var(--brass), var(--brass2));
  color: #1c1206; font-weight: 800; border: none;
  border-radius: 10px; padding: 12px 18px; font-size: 15px; cursor: pointer;
}
.primary-btn.big { width: 100%; margin-top: 12px; padding: 14px; font-size: 16px; }
.primary-btn:disabled { opacity: .5; cursor: default; }
.mini-btn {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.mini-btn.danger { color: var(--danger); border-color: #5a2b3a; }
.chip-btn {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px; font-size: 15px; cursor: pointer;
}
.chip-btn.recording { background: #5a1f2b; border-color: var(--danger); color: #ffd7d7; }
.profile-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.profile-chip {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 10px 16px; font-size: 15px; cursor: pointer;
}
.profile-chip:active { border-color: var(--brass); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.bar-actions { display: flex; gap: 8px; }
.tabs { display: flex; gap: 8px; margin: 12px 0 4px; }
.tab {
  flex: 1; padding: 10px; border-radius: 10px; cursor: pointer;
  background: var(--bg2); color: var(--muted); border: 1px solid var(--line); font-size: 15px;
}
.tab.active { color: var(--text); border-color: var(--brass); }
.inbox { display: flex; flex-direction: column; gap: 10px; }
.msg-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; cursor: pointer; text-align: left; width: 100%; color: var(--text);
}
.msg-card .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.msg-card .state { font-weight: 700; letter-spacing: .06em; font-size: 11px; }
.state.sealed { color: var(--dot); }
.state.opened { color: var(--ok); }
.dot-field {
  display: flex; flex-wrap: wrap; gap: 5px; align-content: flex-start;
  max-height: 180px; overflow: hidden; padding: 6px 2px;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dot); opacity: .85;
  box-shadow: 0 0 5px rgba(84, 216, 245, .55);
  flex: none;
}
.dot.dim { opacity: .25; box-shadow: none; }
.overlay {
  position: fixed; inset: 0; background: rgba(4, 7, 18, .82);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet {
  background: var(--card); border: 1px solid var(--line); border-bottom: none;
  border-radius: 20px 20px 0 0; width: 100%; max-width: 640px;
  max-height: 92vh; overflow-y: auto; padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet h2 { margin: 0 0 4px; }
.key-btn {
  position: relative; display: block; margin: 16px auto 6px;
  width: 168px; height: 168px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4c56a, var(--brass) 55%, var(--brass2));
  border: 3px solid #7c5514; cursor: pointer; color: #241703;
  font-weight: 900; letter-spacing: .05em; text-align: center;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none;
}
.key-btn .key-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--dot) calc(var(--hold, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%);
  mask: radial-gradient(circle, transparent 62%, #000 63%);
}
.key-btn:active { filter: brightness(1.08); }
.reveal-text { font-size: 19px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.reveal-text .paint { color: var(--dot); }
.how-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.steps { line-height: 1.55; padding-left: 20px; }
.steps li { margin: 8px 0; }
.game-card { border-color: var(--brass2); }
.game-status { font-size: 15px; font-weight: 600; line-height: 1.45; }
.badge-prize {
  display: inline-block; background: linear-gradient(180deg, var(--brass), var(--brass2));
  color: #1c1206; font-weight: 800; font-size: 11px; letter-spacing: .06em;
  border-radius: 999px; padding: 2px 9px; margin-right: 6px; vertical-align: 1px;
}
.admin-card { border-style: dashed; }
.admin-card select {
  display: block; width: 100%; margin-top: 6px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 16px; font-family: inherit;
}
.draw-history { font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.draw-history strong { color: var(--text); }
.app-footer { max-width: 640px; margin: 0 auto; padding: 0 16px 28px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
audio { width: 100%; margin-top: 8px; }
