:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.1);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.7);
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);

  --accent: #7c5cff;
  --accent-2: #00d4ff;

  --radius: 14px;
  --radius-sm: 10px;

  --container: 1080px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Apple SD Gothic Neo,
    "Malgun Gothic", "맑은 고딕", Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

html[data-theme="light"] {
  --bg: #f6f7fb;
  --panel: rgba(0, 0, 0, 0.04);
  --panel-2: rgba(0, 0, 0, 0.07);
  --text: rgba(0, 0, 0, 0.9);
  --muted: rgba(0, 0, 0, 0.65);
  --border: rgba(0, 0, 0, 0.12);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1400px 800px at 20% -10%, rgba(124, 92, 255, 0.35), transparent 55%),
    radial-gradient(1100px 700px at 100% 0%, rgba(0, 212, 255, 0.18), transparent 45%),
    linear-gradient(180deg, var(--bg), var(--bg));
}

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

.container {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 9999;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
}

.skip-link:focus {
  left: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 28, 0.62);
  border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .site-header {
  background: rgba(250, 250, 255, 0.7);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
}

.brand:hover {
  background: var(--panel);
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.brand-text {
  font-weight: 750;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.nav-link {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
}

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

.nav-link.is-active {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.header-actions {
  display: flex;
  gap: 10px;
}

.hero {
  padding: 46px 0 10px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 22px;
  align-items: start;
}

.eyebrow {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.hero-title {
  margin: 12px 0 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-desc {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.hero-meta {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.hero-panel .card {
  height: 100%;
}

.section {
  padding: 26px 0;
}

.section-header {
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.section-desc {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow);
  overflow: clip;
}

html[data-theme="light"] .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.72));
}

.card-header {
  padding: 16px 16px 0;
}

.card-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.015em;
}

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

.card-body {
  padding: 14px 16px 16px;
}

.card-footer {
  padding: 0 16px 16px;
}

.stack {
  display: grid;
  gap: 10px;
}

.game-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.game-row:hover {
  background: var(--panel-2);
}

.game-row-title {
  font-weight: 650;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 750;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.25);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-ghost {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.button-ghost:hover {
  background: var(--panel-2);
}

.link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 4px;
}

html[data-theme="light"] .link {
  text-decoration-color: rgba(0, 0, 0, 0.25);
}

.muted {
  color: var(--muted);
  line-height: 1.65;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
}

.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.sep {
  margin: 0 8px;
  color: var(--muted);
}

.site-footer {
  padding: 20px 0 34px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.spacer {
  height: 16px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  margin-bottom: 12px;
}

.segmented-item {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 750;
}

.segmented-item:hover {
  background: var(--panel-2);
  color: var(--text);
}

.segmented-item.is-active {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text);
}

.segmented-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
}

.stat-value {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.game-board {
  position: relative;
  height: 360px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: radial-gradient(900px 360px at 10% 0%, rgba(255, 255, 255, 0.08), transparent 55%),
    radial-gradient(700px 350px at 100% 100%, rgba(0, 212, 255, 0.1), transparent 55%),
    var(--panel);
  overflow: hidden;
}

.target {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  color: var(--text);
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 14px 18px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.target:active {
  transform: translate(-50%, -50%) scale(0.98);
}

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

.memory-card {
  position: relative;
  height: 74px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 22px;
  user-select: none;
}

.memory-card:focus-visible {
  outline: 2px solid rgba(124, 92, 255, 0.75);
  outline-offset: 2px;
}

.memory-card[data-state="down"] {
  color: var(--muted);
}

.memory-card[data-state="up"],
.memory-card[data-state="matched"] {
  background: var(--panel-2);
  color: var(--text);
}

.memory-card[data-state="matched"] {
  border-color: rgba(0, 212, 255, 0.35);
}

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
  .nav {
    justify-content: flex-start;
  }
}

@media (max-width: 740px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .game-hud {
    grid-template-columns: 1fr 1fr;
  }
}
