@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #eef2f9;
  --panel: #ffffff;
  --panel-guide: #f7f8fb;
  --border: #e2e8f0;
  --border-soft: rgba(148,163,184,0.18);
  --text: #1e293b;
  --muted: #64748b;
  --blue: #3b82f6;
  --green: #22c55e;
  --yellow: #f59e0b;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.04);
  --font: "Be Vietnam Pro", "Segoe UI", Roboto, sans-serif;
  --input-bg: #f8fafc;
  --input-border: #cbd5e1;
  --input-focus: #3b82f6;
  --chip-bg: #fff;
  --chip-border: #d1d5db;
  --chip-text: #374151;
  --success-text: #16a34a;
  --error-text: #dc2626;
  --info-text: #64748b;
}

body.dark {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-guide: #182032;
  --border: #334155;
  --border-soft: rgba(148,163,184,0.12);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.12);
  --input-bg: #334155;
  --input-border: #475569;
  --input-focus: #60a5fa;
  --chip-bg: #334155;
  --chip-border: #475569;
  --chip-text: #e2e8f0;
  --success-text: #4ade80;
  --error-text: #f87171;
  --info-text: #94a3b8;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
  transition: background 0.3s, color 0.3s;
}

a { color: inherit; }
input, textarea, button { font: inherit; }
h1, h2, h3, p, a, label, span, strong, input, textarea, button {
  font-family: var(--font);
}

.shell {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 30px;
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-title {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}

.hero-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.15s;
}

.hero-action-link:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--chip-border);
  border-radius: 12px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s;
}

.hero-chip:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.workspace-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
}

.guide-card {
  padding: 22px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--panel-guide);
}

.guide-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.guide-icon { font-size: 1.1rem; }

.guide-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.guide-list {
  display: grid;
  gap: 20px;
}

.guide-item {
  padding-left: 14px;
  border-left: 3px solid var(--blue);
}

.guide-item.green { border-left-color: var(--green); }
.guide-item.blue { border-left-color: var(--blue); }
.guide-item.gold { border-left-color: var(--yellow); }

.guide-item h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
}

.guide-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.mini-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  margin-top: 10px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.mini-link-button:hover { opacity: 0.88; }

.redeem-main-card {
  padding: 22px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.step-block { padding: 0; }

.step-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.step-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.line-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

input, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.7; }

input:focus, textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.session-field {
  min-height: 48px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: 0.6; cursor: wait; }

.text-action-button {
  height: 44px;
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  border-radius: 10px;
  justify-self: start;
  box-shadow: 0 8px 24px rgba(59,130,246,0.16);
}

.text-action-button:hover:not(:disabled) { opacity: 0.9; }

.step-status {
  margin: 8px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 1.2em;
  color: var(--muted);
  white-space: pre-line;
}

.step-status.status-success { color: var(--success-text); }
.step-status.status-error { color: var(--error-text); }
.step-status.status-info { color: var(--info-text); }

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.primary-large {
  min-width: 120px;
  min-height: 42px;
  padding: 0 22px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 10px;
}

.primary-large:hover:not(:disabled) { opacity: 0.9; }

.footer-card {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.5;
}

.panel {
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.page-nav {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.nav-link {
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.nav-link:hover, .nav-link.active {
  background: var(--panel-guide);
  color: var(--text);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.top-bar .page-nav {
  margin-bottom: 0;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-number {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.summary-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.toolbar button {
  min-height: 42px;
  padding: 0 16px;
  background: var(--panel-guide);
  color: var(--text);
  font-weight: 700;
}

.results-list { display: grid; gap: 10px; }

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.result-code, code { font-family: "Consolas", monospace; }
.result-code { font-size: 0.95rem; font-weight: 700; overflow-wrap: anywhere; }
.result-meta {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge.unused { background: rgba(34,197,94,0.12); color: var(--success-text); }
.badge.used { background: rgba(239,68,68,0.12); color: var(--error-text); }
.badge.invalid { background: rgba(139,92,246,0.12); color: #a78bfa; }

.summary-card.success { background: rgba(34,197,94,0.08); }
.summary-card.error { background: rgba(239,68,68,0.08); }
.summary-card.invalid { background: rgba(139,92,246,0.08); }

.hidden { display: none; }

.status-card {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.88rem;
  border: 1px solid transparent;
}

.status-card.info { background: rgba(100,116,139,0.1); border-color: rgba(100,116,139,0.2); color: var(--muted); }
.status-card.success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.2); color: var(--success-text); }
.status-card.error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.2); color: var(--error-text); }
.status-card.invalid { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.2); color: #a78bfa; }

.ghost {
  min-height: 42px;
  padding: 0 16px;
  background: var(--panel-guide);
  color: var(--text);
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-guide);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.soft-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}

.link-row, .action-row-large { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.step-status {
  min-height: 24px;
  margin: 12px 0 0;
  font-size: 0.98rem;
  color: var(--muted);
}

.status-success { color: var(--success-text); }
.status-error { color: var(--error-text); }
.status-invalid { color: #a78bfa; }
.status-info { color: var(--muted); }

.session-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
  align-items: start;
}

.session-side-actions {
  display: grid;
  gap: 12px;
}

.outlined-button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255, 168, 211, 0.58);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: #ff8dcf;
  font-weight: 700;
}

.outlined-button.strong {
  border-color: var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.auth-summary {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.auth-row + .auth-row {
  margin-top: 22px;
}

.auth-label {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
  letter-spacing: 0.02em;
}

.auth-value,
.auth-plan {
  display: block;
  margin-top: 10px;
  font-size: 1.08rem;
  line-height: 1.45;
}

.auth-plan.success { color: var(--success-text); }
.auth-plan.error { color: #ff6f6f; }

.simple-head {
  margin-bottom: 12px;
}

.simple-head h2 {
  font-size: 1.12rem;
  font-weight: 800;
}

.redeem-reference-layout {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.redeem-reference-guide {
  min-height: 100%;
}

.redeem-reference-list {
  gap: 22px;
}

.redeem-reference-main {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: transparent;
}

.auth-link-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.soft-ghost-button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(255, 168, 211, 0.6);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #ff7fc5;
  font-weight: 700;
}

.session-inline-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.inline-summary {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
  display: grid;
  gap: 4px;
}

.inline-summary-title {
  color: var(--success-text);
  font-size: 0.94rem;
  font-weight: 800;
}

.inline-summary-line {
  color: var(--success-text);
  font-size: 0.88rem;
  font-weight: 600;
}

/* ── Check page ── */

.chk-input-panel {
  margin-top: 14px;
}

.chk-field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 12px;
}

.chk-textarea {
  min-height: 110px;
  resize: vertical;
}

.chk-status-text {
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 500;
}

.chk-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.chk-btn-primary {
  min-height: 50px;
  background: linear-gradient(135deg, #8ba4f0 0%, #6b8cf0 50%, #7c9cf5 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 12px;
  border: none;
  box-shadow: 0 4px 16px rgba(107, 140, 240, 0.22);
}

.chk-btn-primary:hover:not(:disabled) {
  opacity: 0.92;
  box-shadow: 0 6px 20px rgba(107, 140, 240, 0.32);
}

.chk-btn-ghost {
  min-height: 50px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.chk-btn-ghost:hover:not(:disabled) {
  background: var(--panel-guide);
}

.chk-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 14px 0;
}

.chk-summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chk-stat-number {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.chk-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: capitalize;
  color: var(--muted);
}

.chk-results-panel {
  margin-bottom: 30px;
}

.chk-copy-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.chk-copy-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.chk-copy-btn {
  min-height: 38px;
  padding: 0 16px;
  background: var(--panel-guide);
  color: var(--text);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.chk-copy-btn:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
}

.chk-tabs {
  display: flex;
  gap: 24px;
}

.chk-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0;
  transition: color 0.2s;
}

.chk-tab:hover {
  color: var(--text);
  transform: none;
}

.chk-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.chk-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 18px;
}

.chk-empty-state {
  text-align: center;
  padding: 48px 20px;
}

.chk-empty-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--blue);
  margin: 0 0 8px;
}

.chk-empty-desc {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

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

@media (max-width: 640px) {
  .shell {
    width: calc(100vw - 20px);
    padding: 12px 0 20px;
  }

  .hero-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 18px;
  }

  .hero-title { font-size: 1.35rem; }

  .hero-actions { width: 100%; }
  .hero-action-link,
  .hero-chip { flex: 1 1 0; }

  .workspace-card, .guide-card { padding: 14px; }
  .redeem-main-card { padding: 14px; }

  .line-form { grid-template-columns: 1fr; }
  .session-grid { grid-template-columns: 1fr; }
  .session-side-actions { grid-template-columns: 1fr; }

  .text-action-button {
    width: 100%;
    justify-self: stretch;
  }

  .primary-large { width: 100%; }
  .outlined-button { width: 100%; }
  .soft-ghost-button { width: 100%; }
  .auth-link-row { justify-content: stretch; }
  .session-inline-layout { grid-template-columns: 1fr; }

  .summary-grid, .result-row { grid-template-columns: 1fr; }
  .chk-summary-grid { grid-template-columns: 1fr; }
  .chk-action-row { grid-template-columns: 1fr; }

  .soft-link-button { width: 100%; }
}

/* ===== 2026 refresh UI ===== */
body {
  background:
    radial-gradient(1200px 600px at 10% -5%, rgba(59,130,246,.18), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(99,102,241,.16), transparent 55%),
    var(--bg);
}

.hero-card,
.workspace-card,
.footer-card {
  backdrop-filter: blur(6px);
  border-color: rgba(148,163,184,.24);
}

.hero-card {
  border-radius: 20px;
}

.hero-action-link {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.hero-chip {
  border-radius: 14px;
}

.workspace-card {
  border-radius: 20px;
}

.guide-card,
.redeem-main-card {
  border-radius: 18px;
}

.step-block {
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,255,255,.68));
}

.text-action-button,
.primary-large {
  border-radius: 12px;
}

.primary-large {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  box-shadow: 0 10px 20px rgba(37,99,235,.22);
}

.step-status {
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(148,163,184,.08);
}

.auth-summary {
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(255,255,255,.72);
  padding: 12px;
}

.footer-card {
  margin-top: 14px;
  border-radius: 16px;
}

body.dark .step-block {
  background: linear-gradient(180deg, rgba(15,23,42,.65), rgba(15,23,42,.45));
}

body.dark .auth-summary {
  background: rgba(15,23,42,.5);
}
