:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #edf3fa;
  --ink: #162033;
  --muted: #667085;
  --line: #d8e2ee;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --green: #059669;
  --red: #dc2626;
  --amber: #b45309;
  --shadow: 0 16px 40px rgba(22, 32, 51, 0.1);
  --shadow-soft: 0 8px 24px rgba(22, 32, 51, 0.07);
  --radius: 8px;
  --sidebar: 286px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.13), transparent 360px),
    linear-gradient(180deg, #f8fbff 0, var(--bg) 440px);
  color: var(--ink);
  font-family: Inter, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  padding: 22px 14px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px 22px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-group {
  margin: 10px 0 18px;
}

.nav-title {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  padding: 8px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border-radius: var(--radius);
  color: var(--muted);
  padding: 10px;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
  background: #e8f0ff;
  color: var(--blue-2);
}

.main {
  min-width: 0;
  padding: 28px;
}

.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  border-radius: 0;
  background: linear-gradient(90deg, rgba(10, 18, 32, 0.86), rgba(10, 18, 32, 0.34)), url("../assets/images/main2.png") center/cover;
  color: #fff;
  padding: 56px;
  display: flex;
  align-items: flex-end;
}

.hero-content {
  max-width: 760px;
}

.eyebrow {
  color: #b8d3ff;
  font-weight: 800;
  margin: 0 0 10px;
}

h1 {
  font-size: clamp(2.05rem, 5vw, 4.25rem);
  line-height: 1.08;
  margin: 0 0 16px;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  margin: 0 0 12px;
}

h3 {
  margin: 0 0 8px;
}

.lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0 0 18px;
  max-width: 820px;
}

.hero .lead {
  color: rgba(255, 255, 255, 0.86);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 15px;
  text-decoration: none;
  transition: background 0.18s ease, transform 0.18s ease;
}

.button:hover {
  background: var(--blue-2);
  transform: translateY(-1px);
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.section {
  margin-top: 28px;
}

.card,
.tool-panel,
.chart-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.card {
  display: block;
  padding: 20px;
  text-decoration: none;
}

.card:hover {
  box-shadow: var(--shadow);
}

.card .icon {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: #e8f0ff;
  color: var(--blue);
  font-size: 1.3rem;
  margin-bottom: 14px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.tool-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.field label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
}

.field input:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  outline: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 1.28rem;
}

.chart-panel {
  height: 430px;
  padding: 16px;
  margin-top: 16px;
}

.chart-panel.tall {
  height: 520px;
}

.chart-panel canvas {
  width: 100% !important;
  height: 100% !important;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead {
  background: #edf4ff;
}

.notice {
  border-left: 4px solid var(--blue);
  background: #e8f0ff;
  color: #1e3a8a;
  padding: 12px 14px;
  border-radius: var(--radius);
  margin: 16px 0;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.game-toolbar {
  justify-content: flex-end;
}

.game-frame-panel {
  height: min(78vh, 860px);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #090b12;
  box-shadow: var(--shadow-soft);
}

.game-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 940px) {
  .app-shell {
    display: block;
  }

  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 64px 12px auto;
    height: min(72vh, 680px);
    z-index: 30;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    display: block;
  }

  .main {
    padding: 18px 14px 32px;
  }

  .hero {
    min-height: 440px;
    padding: 34px 22px;
  }

  .tool-header {
    display: block;
  }

  .chart-panel,
  .chart-panel.tall {
    height: 340px;
  }

  .game-toolbar {
    justify-content: flex-start;
  }

  .game-frame-panel {
    height: 72vh;
    min-height: 500px;
  }
}
