﻿:root {
  --bg-base: #061019;
  --bg-surface: #0b1725;
  --bg-card: rgba(14, 24, 38, 0.9);
  --bg-raised: #142337;
  --bg-input: rgba(8, 17, 29, 0.92);

  --border-dim: rgba(88, 127, 164, 0.18);
  --border-default: rgba(105, 146, 185, 0.28);
  --border-bright: rgba(156, 196, 230, 0.42);

  --text-primary: #e6eff8;
  --text-secondary: #96aec5;
  --text-muted: #56718b;

  --gold: #d2a84e;
  --gold-light: #f2cf7a;
  --gold-dim: #6e5121;
  --gold-glow: rgba(210, 168, 78, 0.2);

  --blue: #2b86d9;
  --blue-light: #7bc6ff;
  --blue-dim: #153458;
  --blue-glow: rgba(43, 134, 217, 0.28);

  --teal: #2db5a3;
  --teal-light: #6ee7d8;
  --teal-dim: #103c3a;

  --purple: #8a5cf6;
  --purple-dim: #2b1b58;

  --error: #ef4444;
  --error-dim: rgba(239, 68, 68, 0.14);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --transition: 0.18s ease;

  color-scheme: dark;
  font-family: Bahnschrift, "Yu Gothic UI", "Meiryo UI", sans-serif;
}

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

body {
  margin: 0;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text-primary);
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(43, 134, 217, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(210, 168, 78, 0.16), transparent 24%),
    linear-gradient(180deg, #07111a 0%, #08131e 24%, #060d15 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background:
    linear-gradient(rgba(125, 156, 188, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 156, 188, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent 90%);
}

body::after {
  background:
    radial-gradient(circle at 15% 20%, rgba(123, 198, 255, 0.12), transparent 20%),
    radial-gradient(circle at 80% 10%, rgba(242, 207, 122, 0.1), transparent 18%),
    radial-gradient(circle at 50% 100%, rgba(45, 181, 163, 0.08), transparent 26%);
}

header {
  position: relative;
  overflow: hidden;
  padding: 34px 32px 28px;
  background: linear-gradient(180deg, rgba(5, 10, 16, 0.92) 0%, rgba(9, 20, 31, 0.88) 100%);
  border-bottom: 1px solid var(--border-dim);
}

header::before {
  content: "";
  position: absolute;
  top: -240px;
  right: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 207, 122, 0.18) 0%, rgba(43, 134, 217, 0.08) 45%, transparent 72%);
  filter: blur(8px);
  pointer-events: none;
}

header::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(123, 198, 255, 0.18) 18%,
    rgba(242, 207, 122, 0.7) 50%,
    rgba(123, 198, 255, 0.18) 82%,
    transparent 100%
  );
  pointer-events: none;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  max-width: 1560px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

header h1 {
  margin: 0 0 3px;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold-light);
  text-shadow: 0 0 24px rgba(210, 168, 78, 0.18);
}

header p {
  max-width: 720px;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

footer {
  padding: 18px 32px 24px;
  background: rgba(8, 17, 27, 0.92);
  border-top: 1px solid var(--border-dim);
}

footer small {
  display: block;
  max-width: 1560px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.footer-legal {
  margin-bottom: 6px;
}

.footer-legal small {
  display: block;
  max-width: 1560px;
  margin: 0 auto 2px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.footer-legal a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.build-info {
  margin-top: 6px;
  color: var(--text-secondary);
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
}

main {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
  width: min(1560px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.card {
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
  padding: 24px 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 18%),
    linear-gradient(135deg, rgba(123, 198, 255, 0.05), transparent 34%),
    var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  animation: card-enter 360ms ease both;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 207, 122, 0.78), transparent);
}

.card::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -90px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(123, 198, 255, 0.08), transparent 66%);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-bright);
  box-shadow: 0 26px 56px rgba(0, 0, 0, 0.38);
}

.card h2 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-light);
}

#step1 {
  grid-column: 1 / -1;
  border-color: rgba(210, 168, 78, 0.2);
}

#step2,
#step3,
#debugNormal,
#debugError {
  grid-column: span 6;
}

#step4 {
  grid-column: 1 / -1;
  border-color: rgba(43, 134, 217, 0.22);
}

#debugNormal {
  border-color: rgba(45, 181, 163, 0.2);
}

#debugError {
  border-color: rgba(239, 68, 68, 0.22);
}

.hidden {
  display: none !important;
}

label {
  display: block;
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

input[type="url"],
input[type="text"],
input[type="email"],
input[type="password"],
select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 13px 15px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition), transform var(--transition);
}

input[type="url"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
  transform: translateY(-1px);
  background: rgba(12, 23, 36, 0.98);
  border-color: rgba(123, 198, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(43, 134, 217, 0.16);
}

select {
  cursor: pointer;
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%237090aa' d='M5 7L0 2h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

button {
  position: relative;
  width: 100%;
  margin-top: 6px;
  padding: 11px 20px;
  border: none;
  border-radius: 12px;
  outline: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition:
    background var(--transition),
    box-shadow var(--transition),
    color var(--transition),
    transform var(--transition),
    border-color var(--transition),
    opacity var(--transition);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  box-shadow: 0 0 0 4px rgba(123, 198, 255, 0.14);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  margin-top: 0;
  padding: 11px 20px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition:
    background var(--transition),
    box-shadow var(--transition),
    color var(--transition),
    transform var(--transition),
    border-color var(--transition),
    opacity var(--transition);
}

.button-link:hover {
  transform: translateY(-1px);
}

.button-link:active {
  transform: translateY(0);
}

.button-link.ghost {
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
}

.button-link.ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-bright);
  color: var(--text-primary);
}

#loadBtn,
#loadPlayersBtn,
#compareBtn {
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid rgba(123, 198, 255, 0.18);
  background: linear-gradient(135deg, #2b86d9 0%, #1e5fb6 48%, #154488 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(43, 134, 217, 0.22);
}

#loadBtn:hover,
#loadPlayersBtn:hover,
#compareBtn:hover {
  background: linear-gradient(135deg, #52a8f4 0%, #2b86d9 42%, #17518f 100%);
  box-shadow: 0 16px 32px rgba(43, 134, 217, 0.28);
}

#connectBtn {
  width: auto;
  margin-top: 0;
  padding: 11px 18px;
  border: 1px solid rgba(210, 168, 78, 0.34);
  background: linear-gradient(135deg, rgba(110, 81, 33, 0.95) 0%, rgba(154, 116, 47, 0.95) 100%);
  color: #fff3c7;
  box-shadow: 0 10px 22px rgba(210, 168, 78, 0.18);
}

#connectBtn:hover {
  background: linear-gradient(135deg, #92692f 0%, var(--gold) 100%);
  color: #fff;
  box-shadow: 0 16px 28px rgba(210, 168, 78, 0.22);
}

.ghost {
  width: auto;
  margin-top: 0;
  padding: 11px 18px;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.lang-btn {
  width: auto;
  min-width: 68px;
  margin-top: 0;
  padding: 9px 16px;
  border: 1px solid rgba(210, 168, 78, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.lang-btn:hover {
  border-color: rgba(242, 207, 122, 0.6);
  color: #fff5d6;
}

.oauth-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border-dim);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(123, 198, 255, 0.05), transparent 40%),
    rgba(6, 14, 23, 0.72);
}

.message {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
  color: #ff8d8d;
  white-space: pre-line;
}

.submessage {
  font-size: 13px;
  color: var(--text-secondary);
}

.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.step4-header {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(105, 146, 185, 0.14);
}

.step4-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.step4-header h2 {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}

.step4-header .tabs {
  margin-bottom: 0;
}

.step4-header .zoom-controls {
  margin-bottom: 0;
  margin-left: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-dim);
  border-radius: 999px;
  background: rgba(4, 10, 17, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tab {
  width: auto;
  margin-top: 0;
  padding: 8px 15px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.tab.active {
  background: linear-gradient(135deg, rgba(43, 134, 217, 0.92), rgba(21, 68, 136, 0.92));
  color: #fff;
  box-shadow: 0 10px 18px rgba(43, 134, 217, 0.24);
}

.phase-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
  width: 100%;
}

.phase-btn {
  width: auto;
  margin-top: 0;
  padding: 7px 13px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: rgba(15, 28, 44, 0.9);
  color: var(--text-secondary);
  font-size: 12px;
  transition: all var(--transition);
}

.phase-btn:hover {
  border-color: rgba(138, 92, 246, 0.78);
  color: var(--text-primary);
  box-shadow: 0 8px 16px rgba(138, 92, 246, 0.14);
}

.phase-btn.active {
  border-color: rgba(167, 139, 250, 0.78);
  background: linear-gradient(135deg, rgba(138, 92, 246, 0.22), rgba(72, 45, 133, 0.5));
  color: #ddd6fe;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border-dim);
  border-radius: 999px;
  background: rgba(4, 10, 17, 0.82);
}

.zoom-controls button {
  width: auto;
  margin-top: 0;
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
}

.zoom-controls button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

.timeline-layer-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border-dim);
  border-radius: 999px;
  background: rgba(4, 10, 17, 0.82);
}

.timeline-layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 5px 9px 5px 6px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}

.timeline-layer-toggle input {
  appearance: none;
  flex: 0 0 auto;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 1px solid rgba(105, 146, 185, 0.38);
  border-radius: 999px;
  background:
    radial-gradient(circle at 10px 50%, rgba(226, 232, 240, 0.96) 0 6px, transparent 6.5px),
    linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.92));
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.35),
    0 0 0 0 rgba(45, 181, 163, 0);
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.timeline-layer-toggle input:checked {
  border-color: rgba(110, 231, 216, 0.58);
  background:
    radial-gradient(circle at 24px 50%, #f8fffe 0 6px, transparent 6.5px),
    linear-gradient(135deg, rgba(45, 181, 163, 0.95), rgba(43, 134, 217, 0.95));
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.18),
    0 0 14px rgba(45, 181, 163, 0.18);
}

.timeline-layer-toggle input:focus-visible {
  outline: 2px solid rgba(110, 231, 216, 0.72);
  outline-offset: 2px;
}

.timeline-layer-toggle input:disabled {
  cursor: not-allowed;
  border-color: rgba(105, 146, 185, 0.18);
  background:
    radial-gradient(circle at 10px 50%, rgba(148, 163, 184, 0.56) 0 6px, transparent 6.5px),
    linear-gradient(180deg, rgba(30, 41, 59, 0.42), rgba(15, 23, 42, 0.42));
}

.timeline-layer-toggle:has(input:checked) {
  background: rgba(45, 181, 163, 0.14);
  color: var(--teal-light);
}

.timeline-layer-toggle:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

#zoomLabel {
  min-width: 44px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}


#step4.has-error .tabs,
#step4.has-error .zoom-controls,
#step4.has-error #phaseContainer {
  display: none;
}

#step2 {
  display: flex;
  flex-direction: column;
}

#step2Message {
  display: block;
}

#step4.has-error #step4Message {
  margin-top: 0;
  font-size: 1rem;
}
