:root {
  --bg-0: #0a0e1c;
  --bg-1: #141a33;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --text: #eef1ff;
  --text-dim: #9aa2c4;
  --accent: #ff4d8d;
  --accent-2: #7b5cff;
  --orange: #ff9a3d;
  --good: #3ddc97;
  --bad: #ff5d6c;
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(123, 92, 255, 0.35), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(255, 77, 141, 0.25), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 640px;
  padding: 16px 16px 48px;
}

.app-header {
  width: 100%;
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 8px 8px;
}

.brand { display: flex; align-items: center; }

.brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.3px; }

.brand-sub { font-size: 12px; color: var(--text-dim); }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.setup-card { margin-top: 16px; }

.setup-title { margin: 0 0 6px; font-size: 24px; letter-spacing: 0.2px; }

.setup-hint { margin: 0 0 20px; color: var(--text-dim); font-size: 14px; line-height: 1.5; }

.tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.setup-form { display: flex; flex-direction: column; gap: 16px; }

.field-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 7px; }

.field span { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

input {
  font: inherit;
  font-size: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 77, 141, 0.2);
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
  padding-right: 40px;
  width: 100%;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.number { position: relative; }

.step-btn {
  position: absolute;
  right: 4px;
  width: 24px;
  height: calc(50% - 3px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}

.step-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

.step-up { top: 3px; }
.step-down { bottom: 3px; }

.step-btn::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid currentColor;
}

.step-down::before {
  border-bottom: 0;
  border-top: 6px solid currentColor;
}

.step-btn:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #fff;
}

.step-btn:active { transform: scale(0.92); }

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 93, 108, 0.12);
  border: 1px solid rgba(255, 93, 108, 0.4);
  color: var(--bad);
  font-size: 13px;
}

.primary-btn, .secondary-btn, .ghost-btn, .mini-btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s, background 0.15s;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 13px 22px;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(255, 77, 141, 0.35);
}

.primary-btn--wide { width: 100%; }

.primary-btn:disabled, .secondary-btn:disabled, .ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-btn:not(:disabled):hover, .secondary-btn:not(:disabled):hover, .ghost-btn:not(:disabled):hover {
  filter: brightness(1.1);
}

.primary-btn:not(:disabled):active, .secondary-btn:not(:disabled):active, .ghost-btn:not(:disabled):active {
  transform: scale(0.98);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 12px 18px;
  font-size: 14px;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  padding: 11px 18px;
  font-size: 14px;
}

.ghost-btn--full { width: 100%; }

.mini-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 7px;
}

.draw-card { margin-top: 16px; }

.draw-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.draw-meta { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

.draw-meta-value { font-size: 18px; font-weight: 700; margin-top: 4px; }

.draw-head-stats { display: flex; gap: 20px; }

.stat { text-align: right; }

.stat-value { font-size: 20px; font-weight: 800; line-height: 1; }

.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

.drum {
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius);
  background:
    radial-gradient(400px 160px at 50% 110%, rgba(123, 92, 255, 0.22), transparent 70%),
    rgba(0, 0, 0, 0.28);
  border: 1px dashed var(--card-border);
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}

.drum-number {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 0 30px rgba(255, 77, 141, 0.6);
  transition: transform 0.05s linear;
  line-height: 1;
}

.drum-msg { font-size: 13px; color: var(--text-dim); }

.drum-number.winner {
  background: linear-gradient(135deg, var(--orange), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-size: 84px;
  text-shadow: none;
  filter: drop-shadow(0 0 22px rgba(255, 154, 61, 0.55));
}

.draw-actions { display: flex; gap: 10px; }

.draw-actions--second { margin-top: 10px; }

.draw-actions .primary-btn { flex: 1; }

.result-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 154, 61, 0.08);
  border: 1px solid rgba(255, 154, 61, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-title { font-size: 16px; font-weight: 800; }

.result-seed {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-dim);
}

.result-seed code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 8px;
  border-radius: 6px;
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

.history { margin-top: 16px; }

.history-title { font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 10px; }

.history-list { display: flex; flex-wrap: wrap; gap: 8px; }

.history-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
}

.app-footer { margin-top: 28px; text-align: center; font-size: 12px; color: var(--text-dim); }

.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 16, 0.75); }

.modal-card {
  position: relative;
  width: calc(100% - 32px);
  max-width: 480px;
  background: var(--bg-1);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.modal-title { margin: 0 0 8px; font-size: 20px; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.verify-form { display: flex; flex-direction: column; gap: 14px; }

.verify-result {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid;
}

.verify-result.ok {
  background: rgba(61, 220, 151, 0.1);
  border-color: rgba(61, 220, 151, 0.4);
  color: var(--good);
}

.verify-result.fail {
  background: rgba(255, 93, 108, 0.1);
  border-color: rgba(255, 93, 108, 0.4);
  color: var(--bad);
}

.verify-result.neutral {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--card-border);
  color: var(--text);
}

@media (max-width: 480px) {
  .container, .app-header { padding-left: 12px; padding-right: 12px; max-width: 100%; }
  .field-group { grid-template-columns: 1fr; }
  .drum-number { font-size: 52px; }
  .drum-number.winner { font-size: 68px; }
}