:root {
  --bg: #0f172a;
  --card: #1e293b;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --text: #f1f5f9;
  --muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(56, 189, 248, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(14, 165, 233, 0.08), transparent);
  color: var(--text);
  font-family: "Noto Sans JP", sans-serif;
  padding: 1.5rem;
}

body[data-target] {
  padding-top: 3.5rem;
}

.container {
  text-align: center;
  max-width: 720px;
  width: 100%;
}

header {
  margin-bottom: 2.5rem;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.subtitle {
  font-size: 1rem;
  color: var(--muted);
}

/* トップページの受験種別リンク */
.top-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.exam-link {
  display: inline-block;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--card);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.exam-link:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent);
}

.top-note {
  font-size: 0.95rem;
  color: var(--muted);
}

/* タイマーページのナビ */
.timer-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  z-index: 10;
}

.timer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.timer-nav a:hover {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
}

.timer-nav .current {
  color: var(--accent);
  font-size: 0.9rem;
  padding: 0.35rem 0.6rem;
  font-weight: 700;
}

.countdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.unit {
  background: var(--card);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  min-width: 100px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.unit .value {
  display: block;
  font-family: "Orbitron", "Noto Sans JP", sans-serif;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

.unit .label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.target-date {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.note {
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.85;
}

.viewer-count {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.viewer-count #viewer-current,
.viewer-count #viewer-total {
  font-weight: 700;
  color: var(--accent);
}

.viewer-my-name {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.viewer-list-wrap {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.viewer-list-title {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.viewer-list {
  list-style: none;
}

.viewer-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  font-size: 0.9rem;
}

.viewer-list-item:last-child {
  border-bottom: none;
}

.viewer-name {
  font-weight: 600;
  color: var(--text);
}

.viewer-cheers {
  font-size: 0.8rem;
  color: var(--accent);
}

.cheer-btn {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.cheer-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.25);
}

.cheer-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* エヴァ風モード用：通常時は非表示 */
.eva-block {
  display: none;
  margin-bottom: 2rem;
}

.theme-toggle-wrap {
  margin-bottom: 1.5rem;
}

.theme-toggle {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* エヴァ風テーマ */
body.theme-eva {
  background: #000;
  background-image: none;
  color: #f5e6a3;
}

body.theme-eva[data-target] {
  padding-top: 3.5rem;
}

body.theme-eva .timer-nav {
  background: rgba(0, 0, 0, 0.95);
  border-bottom-color: #b8860b;
}

body.theme-eva .timer-nav a {
  color: #c9b86c;
}

body.theme-eva .timer-nav a:hover {
  color: #f5e6a3;
  background: rgba(184, 134, 11, 0.2);
}

body.theme-eva .timer-nav .current {
  color: #e74c3c;
}

body.theme-eva h1,
body.theme-eva .subtitle {
  color: #f5e6a3;
}

body.theme-eva .countdown {
  display: none;
}

body.theme-eva .eva-block {
  display: block;
}

body.theme-eva .eva-label {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f5e6a3;
  margin-bottom: 0.25rem;
  letter-spacing: 0.1em;
}

body.theme-eva .eva-sublabel {
  font-size: 1rem;
  color: #f5e6a3;
  margin-bottom: 0.5rem;
}

body.theme-eva .eva-days {
  font-size: 1.1rem;
  color: #f5e6a3;
  margin-bottom: 0.5rem;
  min-height: 1.5em;
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  display: inline-block;
}

body.theme-eva .eva-readout {
  font-family: "Orbitron", monospace;
  font-size: clamp(2.5rem, 12vw, 5rem);
  font-weight: 700;
  color: #e74c3c;
  text-shadow: 0 0 20px rgba(231, 76, 60, 0.8), 0 0 40px rgba(231, 76, 60, 0.4);
  letter-spacing: 0.05em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  min-width: 8ch;
  display: inline-block;
  text-align: center;
}

body.theme-eva .target-date,
body.theme-eva .note,
body.theme-eva .viewer-count {
  color: #c9b86c;
}

body.theme-eva .viewer-count #viewer-current,
body.theme-eva .viewer-count #viewer-total {
  color: #f5e6a3;
}

body.theme-eva .viewer-my-name {
  color: #c9b86c;
}

body.theme-eva .viewer-list-wrap {
  background: rgba(0, 0, 0, 0.4);
  border-color: #b8860b;
}

body.theme-eva .viewer-list-title {
  color: #f5e6a3;
}

body.theme-eva .viewer-name {
  color: #f5e6a3;
}

body.theme-eva .viewer-cheers {
  color: #e74c3c;
}

body.theme-eva .cheer-btn {
  color: #f5e6a3;
  background: rgba(184, 134, 11, 0.2);
  border-color: #b8860b;
}

body.theme-eva .cheer-btn:hover:not(:disabled) {
  background: rgba(231, 76, 60, 0.2);
  border-color: #e74c3c;
}

body.theme-eva .theme-toggle {
  color: #c9b86c;
  border-color: #b8860b;
}

body.theme-eva .theme-toggle:hover {
  color: #f5e6a3;
  border-color: #f5e6a3;
}

body.theme-eva .theme-toggle[aria-pressed="true"] {
  color: #e74c3c;
  border-color: #e74c3c;
}

@media (max-width: 480px) {
  .countdown {
    gap: 0.75rem 1rem;
  }
  .unit {
    min-width: 72px;
    padding: 1rem 0.75rem;
  }
  .unit .value {
    font-size: 1.75rem;
  }
  body.theme-eva .eva-readout {
    font-size: 2rem;
  }
}
