:root {
  --bg-0: #0b0d17;
  --bg-1: #12162a;
  --bg-2: #1a1f3a;
  --card: #171b2f;
  --border: #2a3057;
  --text-0: #f1f3ff;
  --text-1: #a9aed6;
  --text-2: #6d729a;
  --accent: #7c5cff;
  --accent-2: #ff5c9e;
  --good: #3ddc97;
  --bad: #ff5c6c;
  --warn: #ffcb47;
  --font: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --mono: "Consolas", "Cascadia Mono", "Yu Gothic", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font);
}

body {
  position: relative;
  overflow-x: hidden;
  padding-bottom: 60px;
}

.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 10%, rgba(124, 92, 255, 0.25), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(255, 92, 158, 0.18), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(61, 220, 151, 0.12), transparent 50%),
    var(--bg-0);
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 13, 23, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 18px 20px 14px;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.deluxe {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

.subtitle {
  margin: 0 0 12px;
  color: var(--text-1);
  font-size: 0.9rem;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.stat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  min-width: 74px;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-2);
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ghost-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.ghost-btn:hover { border-color: var(--accent); }
.ghost-btn:active { transform: scale(0.97); }
.ghost-btn.small { padding: 5px 10px; font-size: 0.75rem; }

.primary-btn {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: scale(0.97); }

.progress-outer {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--good), #6be3c4);
  transition: width 0.25s ease;
}

/* ---------- layout ---------- */
.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

.input-section {
  position: sticky;
  top: 190px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (max-width: 860px) {
  .input-section { position: static; }
}

.input-label {
  font-size: 0.85rem;
  color: var(--text-1);
  font-weight: 600;
}

.pw-input {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  color: var(--text-0);
  font-family: var(--mono);
  font-size: 1.15rem;
  line-height: 1.5;
  padding: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pw-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25);
}

.meter-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-1);
  margin-bottom: 8px;
}
.meter-outer {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}
.meter-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--bad), var(--warn), var(--good));
  transition: width 0.25s ease;
}

.captcha-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.captcha-block.hidden { display: none; }
.captcha-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-1);
}
#captcha-canvas {
  width: 100%;
  border-radius: 8px;
  background: #fff;
}

/* ---------- rules ---------- */
.rules-section h2 {
  font-size: 1.05rem;
  margin: 6px 0 12px;
  color: var(--text-1);
}

.rules-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-2);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.92rem;
  animation: reveal 0.35s ease;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.rule-item.ok {
  border-left-color: var(--good);
  background: linear-gradient(90deg, rgba(61, 220, 151, 0.10), var(--card) 40%);
}
.rule-item.fail {
  border-left-color: var(--bad);
  background: linear-gradient(90deg, rgba(255, 92, 108, 0.10), var(--card) 40%);
}
.rule-item.shake { animation: shake 0.3s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.rule-icon {
  font-size: 1.05rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.rule-text {
  color: var(--text-0);
  line-height: 1.45;
}
.rule-num {
  color: var(--text-2);
  font-weight: 700;
  margin-right: 4px;
}

/* ---------- win overlay ---------- */
.win-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 7, 14, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}
.win-overlay.hidden { display: none; }

#confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.win-card {
  position: relative;
  z-index: 2;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 30px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.win-card h2 { margin-top: 0; font-size: 1.8rem; }
.win-card p { color: var(--text-1); }

.win-stats {
  display: flex;
  justify-content: space-around;
  margin: 18px 0;
}
.win-stats div { display: flex; flex-direction: column; gap: 2px; }
.win-stats span { font-size: 0.72rem; color: var(--text-2); }
.win-stats strong { font-size: 1.2rem; }

.win-pw-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 20px;
  overflow-x: auto;
}
.win-pw-box code {
  font-family: var(--mono);
  color: var(--good);
  white-space: pre;
  flex: 1;
  text-align: left;
}

/* ---------- history modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 7, 14, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 26px;
  max-width: 480px;
  width: 90%;
  max-height: 76vh;
  overflow-y: auto;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-head h2 { margin: 0; font-size: 1.2rem; }

.history-entry {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}
.history-entry:first-child { border-top: none; }
.history-entry .h-ver {
  font-weight: 700;
  color: var(--accent);
}
.history-entry .h-date {
  color: var(--text-2);
  font-size: 0.78rem;
  margin-left: 6px;
}
.history-entry ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--text-1);
  font-size: 0.85rem;
}

.site-footer {
  text-align: center;
  color: var(--text-2);
  font-size: 0.78rem;
  padding: 20px;
}
