:root {
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --text: #0B1F3F;
  --muted: #5B6B82;
  --accent: #0078D4;
  --gold: #F5B400;
  --danger: #C8102E;
  --border: #D9E1EC;
  --amida-line: #9AA5B8;
  --mono: "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1220;
    --card: #141D2E;
    --text: #E8EEF8;
    --muted: #9AA8BF;
    --border: #26324A;
    --amida-line: #56637A;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Meiryo", system-ui, sans-serif;
  line-height: 1.6;
}
main { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 22px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
input[type=text], input[type=password] {
  width: 100%;
  font-size: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
button {
  font: inherit;
  font-weight: bold;
  font-size: 17px;
  padding: 12px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.danger { background: var(--danger); }
.full { width: 100%; margin-top: 12px; }
.error { color: var(--danger); font-size: 14px; min-height: 1.4em; margin: 8px 0 0; }
.big { font-size: 28px; font-weight: bold; text-align: center; margin: 8px 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.log {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  min-height: 9em;
}
.log .ok { color: #3CC5A0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: bold;
}
.result-win { color: var(--gold); }
canvas.amida { width: 100%; height: 360px; display: block; }
.footer { font-size: 11px; color: var(--muted); text-align: center; margin-top: 24px; }

@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pop { animation: pop .5s ease-out both; }
