:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;

  --status-active-bg: #dcfce7;
  --status-active-text: #166534;
  --status-soon-end-bg: #fef3c7;
  --status-soon-end-text: #92400e;
  --status-upcoming-bg: #e0e7ff;
  --status-upcoming-text: #3730a3;
  --status-ended-bg: #f1f5f9;
  --status-ended-text: #64748b;

  --discount-bg: #fee2e2;
  --discount-text: #b91c1c;
  --amazon-bg: #fff7ed;
  --amazon-text: #c2410c;
  --amazon-border: #fed7aa;
  --rakuten-bg: #fef2f2;
  --rakuten-text: #b91c1c;
  --rakuten-border: #fecaca;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-subtle: #1e293b;
  --border: #1f2937;
  --border-strong: #334155;
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-border: rgba(59, 130, 246, 0.35);

  --status-active-bg: rgba(34, 197, 94, 0.16);
  --status-active-text: #86efac;
  --status-soon-end-bg: rgba(245, 158, 11, 0.18);
  --status-soon-end-text: #fcd34d;
  --status-upcoming-bg: rgba(99, 102, 241, 0.2);
  --status-upcoming-text: #c7d2fe;
  --status-ended-bg: #1e293b;
  --status-ended-text: #94a3b8;

  --discount-bg: rgba(239, 68, 68, 0.18);
  --discount-text: #fca5a5;
  --amazon-bg: rgba(249, 115, 22, 0.16);
  --amazon-text: #fdba74;
  --amazon-border: rgba(249, 115, 22, 0.32);
  --rakuten-bg: rgba(239, 68, 68, 0.16);
  --rakuten-text: #fca5a5;
  --rakuten-border: rgba(239, 68, 68, 0.32);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font-family: inherit;
  color: inherit;
}

.mono {
  font-family: var(--font-mono);
}

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

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* PR Disclosure Bar */
.pr-bar {
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  padding: 7px 16px;
  text-align: center;
}

.pr-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  margin-right: 6px;
  color: var(--text);
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--text);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-domain {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-subtle);
}

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

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

/* Hero Summary Strip */
.hero {
  padding: 20px 0 14px;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-lead {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  max-width: 640px;
}

.hero-lead strong {
  color: var(--text);
}

.freshness-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 600;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* Sticky Tab Navigation */
.sticky-nav-wrap {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  width: 100%;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.tab-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.tab-btn.active .tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: var(--surface);
}

/* Error Banner */
.error-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--discount-bg);
  color: var(--discount-text);
  font-size: 13px;
  font-weight: 600;
}

/* Global Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toggle-label input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Filter Chips & Controls */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.chip-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.select-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-control {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

/* Cards Grid */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 680px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tabs {
    width: auto;
  }
  .tab-btn {
    flex: 0 0 auto;
  }
}

@media (min-width: 980px) {
  .card-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card.is-ended {
  opacity: 0.62;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.2;
}

.badge-active {
  background: var(--status-active-bg);
  color: var(--status-active-text);
}

.badge-ending_soon {
  background: var(--status-soon-end-bg);
  color: var(--status-soon-end-text);
}

.badge-upcoming {
  background: var(--status-upcoming-bg);
  color: var(--status-upcoming-text);
}

.badge-ended {
  background: var(--status-ended-bg);
  color: var(--status-ended-text);
}

.badge-store-amazon {
  background: var(--amazon-bg);
  color: var(--amazon-text);
  border: 1px solid var(--amazon-border);
}

.badge-store-rakuten {
  background: var(--rakuten-bg);
  color: var(--rakuten-text);
  border: 1px solid var(--rakuten-border);
}

.badge-neutral {
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-jp {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.meta-list {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  font-size: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.meta-key {
  color: var(--text-subtle);
  flex-shrink: 0;
}

.meta-val {
  font-weight: 600;
  text-align: right;
  color: var(--text);
}

/* Deal Price Box */
.price-block {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
}

.price-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.price-sale {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
}

.price-regular {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-subtle);
  text-decoration: line-through;
}

.discount-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  background: var(--discount-bg);
  color: var(--discount-text);
  padding: 3px 8px;
  border-radius: 6px;
}

/* Student AI Comparison Box */
.compare-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.compare-col {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
}

.compare-col.highlight {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.compare-label {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 600;
  margin-bottom: 2px;
}

.compare-price {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.compare-col.highlight .compare-price {
  color: var(--accent);
}

.card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checked-note {
  font-size: 11px;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary.disabled {
  background: var(--surface-subtle);
  color: var(--text-subtle);
  border: 1px solid var(--border);
  pointer-events: none;
}

/* Annual Calendar Section */
.calendar-section {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.calendar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 680px) {
  .calendar-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.cal-month {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cal-month.current-month {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cal-month-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cal-month.current-month .cal-month-num {
  color: var(--accent);
}

.cal-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text);
}

/* Policy Callout */
.policy-note {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 16px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 14px;
}

/* Footer */
.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0 36px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-note {
  max-width: 680px;
  margin: 0;
  line-height: 1.7;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}
