:root {
  --ink: #050509;
  --muted: #5d6273;
  --paper: #f3f6ff;
  --paper-deep: #dfe8fa;
  --line: rgba(7, 12, 29, 0.14);
  --violet: #6400ff;
  --violet-dark: #4600b5;
  --gold: #d7a84f;
  --green: #2c846d;
  --panel: rgba(255, 255, 255, 0.72);
  --shadow: 0 20px 60px rgba(37, 49, 88, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #eef4ff;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.64) 0 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.54) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 34%, rgba(100, 0, 255, 0.12), transparent 30%),
    linear-gradient(135deg, #eef4ff 0%, #f9fbff 52%, #e7eefb 100%);
  background-size: 42px 42px, 42px 42px, auto, auto;
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: 100%;
  padding: clamp(28px, 5vw, 70px);
  pointer-events: none;
}

.menu-button,
.quick-nav {
  pointer-events: auto;
}

.menu-button {
  position: relative;
  z-index: 2;
  width: 40px;
  height: 34px;
  display: inline-grid;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
}

.menu-button span {
  display: block;
  width: 36px;
  height: 6px;
  background: var(--ink);
}

.quick-nav {
  position: absolute;
  top: calc(clamp(28px, 5vw, 70px) + 54px);
  left: clamp(28px, 5vw, 70px);
  display: grid;
  gap: 6px;
  width: 132px;
  padding: 8px;
  border: 1px solid rgba(5, 5, 9, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 44px rgba(37, 49, 88, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.quick-nav.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.quick-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.44);
}

.quick-nav a:hover,
.quick-nav a:focus-visible {
  color: white;
  background: var(--ink);
  outline: none;
}

.section-panel {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: clamp(112px, 12vw, 150px) clamp(18px, 5vw, 72px) clamp(86px, 10vw, 120px);
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(100%, 1180px);
  margin: 0 auto;
}

.hero-copy .eyebrow,
.hero h1 span,
.hero h1 strong,
.maker,
.hero-hint {
  opacity: 0;
  animation: fadeUp 680ms ease forwards;
}

.hero-copy .eyebrow {
  animation-delay: 80ms;
}

.hero h1 span {
  animation-delay: 180ms;
}

.hero h1 strong {
  animation-delay: 280ms;
}

.maker {
  animation-delay: 390ms;
}

.hero-hint {
  animation-delay: 560ms;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--violet-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.hero h1 span,
.hero h1 strong {
  display: block;
}

.hero h1 span {
  font-size: clamp(64px, 8.8vw, 126px);
  font-weight: 850;
}

.hero h1 strong {
  color: var(--violet);
  font-size: clamp(58px, 7.6vw, 108px);
  font-weight: 850;
  line-height: 0.98;
  margin-top: 2px;
}

.maker {
  margin: 32px 0 0;
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(24px, 3.1vw, 40px);
  font-weight: 650;
  line-height: 1;
}

.draw-section,
.database-section {
  padding: clamp(94px, 11vw, 140px) clamp(18px, 5vw, 72px) clamp(64px, 8vw, 96px);
}

.draw-section {
  z-index: 2;
  overflow: visible;
  min-height: auto;
  padding-top: clamp(24px, 4vw, 42px);
}

.draw-section:has(.pick-picker.open) {
  z-index: 60;
}

.hero-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(26px, 4vw, 44px);
  z-index: 3;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.hero-hint::after {
  content: "";
  display: block;
  width: 1px;
  height: 28px;
  margin: 10px auto 0;
  background: rgba(5, 5, 9, 0.38);
}

.section-heading {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto 34px;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 620ms ease,
    transform 620ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.results-area .result-group:nth-child(2),
.database-grid .database-card:nth-child(2n) {
  transition-delay: 90ms;
}

.database-grid .database-card:nth-child(3n) {
  transition-delay: 160ms;
}

.section-heading h2 {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: 0;
}

.draw-section .section-heading h2 {
  font-size: clamp(36px, 5.2vw, 68px);
  font-weight: 750;
}

.section-copy {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
  word-break: keep-all;
}

.section-copy + .section-copy {
  margin-top: 8px;
}

.lotto-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
}

.control-panel,
.result-group,
.database-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel {
  align-self: start;
  position: sticky;
  top: 112px;
  padding: 18px;
  border-radius: 8px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.mode-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 900;
}

.mode-tab.active {
  color: white;
  background: var(--ink);
}

.nickname-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.nickname-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.nickname-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  outline: none;
}

.nickname-field input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(100, 0, 255, 0.14);
}

.button-stack {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 6px;
  font-weight: 600;
}

.primary-button {
  border: 1px solid var(--violet);
  color: white;
  background: var(--violet);
}

.primary-button:hover {
  background: var(--violet-dark);
}

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

.secondary-button:hover {
  color: white;
  background: var(--ink);
}

.status-text {
  min-height: 42px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.results-area {
  display: grid;
  gap: 20px;
  overflow: visible;
}

.result-group {
  position: relative;
  z-index: 1;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 8px;
}

.result-group.picker-open {
  z-index: 40;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.result-mark {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-weight: 900;
}

.result-header h3 {
  margin: 0 0 4px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.15;
}

.result-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.class-grid,
.weapon-grid,
.database-grid {
  display: grid;
  gap: 14px;
}

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

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

.pick-column {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.pick-column.picker-open {
  z-index: 45;
}

.pick-column h4 {
  margin: 0 0 12px;
  color: var(--violet-dark);
  font-size: 15px;
  font-weight: 600;
}

.pick-list {
  display: grid;
  gap: 8px;
  min-height: 88px;
  margin: 0;
  padding-left: 20px;
}

.pick-list:empty::before {
  content: "대기 중";
  display: block;
  color: #8a90a0;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 0;
}

.pick-list li {
  position: relative;
  padding: 10px 11px;
  border-left: 4px solid var(--gold);
  border-radius: 0 6px 6px 0;
  background: rgba(255, 255, 255, 0.88);
  font-weight: 400;
  line-height: 1.4;
  word-break: keep-all;
}

.pick-picker {
  position: relative;
  width: 100%;
}

.pick-choice {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%),
    rgba(255, 255, 255, 0.74);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 11px) 50%,
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100%;
  background-repeat: no-repeat;
  padding: 9px 34px 9px 10px;
  font-weight: 400;
  line-height: 1.25;
  outline: none;
  text-align: left;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.pick-choice:hover {
  border-color: rgba(100, 0, 255, 0.28);
}

.pick-choice:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(100, 0, 255, 0.14);
}

.pick-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: none;
  width: min(280px, calc(100vw - 48px));
  max-height: 260px;
  padding: 7px;
  border: 1px solid rgba(5, 5, 9, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(37, 49, 88, 0.2);
  overflow: auto;
}

.pick-picker.open .pick-menu {
  display: grid;
  gap: 4px;
}

.pick-option {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.28;
  text-align: left;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.pick-option:hover,
.pick-option:focus-visible {
  background: rgba(100, 0, 255, 0.1);
  outline: none;
}

.pick-option.selected {
  color: white;
  background: var(--ink);
}

.pick-option:disabled {
  color: #a2a7b5;
  cursor: not-allowed;
  text-decoration: line-through;
}

.database-section {
  z-index: 1;
  min-height: auto;
}

.database-grid {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 1180px;
  margin: 0 auto;
}

.database-card {
  min-height: 168px;
  padding: 18px;
  border-radius: 8px;
}

.database-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.database-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.database-card ul {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.database-card li {
  padding: 6px 8px;
  border: 1px solid rgba(5, 5, 9, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #303546;
  font-size: 12px;
  font-weight: 800;
}

.database-card li.database-more-item {
  padding: 0;
  border: 0;
  background: transparent;
}

.database-more {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(5, 5, 9, 0.1);
  border-radius: 999px;
  color: #303546;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.database-more:hover,
.database-more:focus-visible {
  color: white;
  background: var(--ink);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

.hidden {
  display: none;
}

@media (max-width: 920px) {
  .lotto-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .class-grid,
  .weapon-grid,
  .database-grid {
    grid-template-columns: 1fr 1fr;
  }

}

@media (max-width: 620px) {
  .topbar {
    padding: 24px 22px;
  }

  .menu-button {
    width: 34px;
    height: 30px;
    gap: 4px;
  }

  .menu-button span {
    width: 31px;
    height: 5px;
  }

  .hero h1 span {
    font-size: clamp(54px, 17vw, 72px);
  }

  .hero h1 strong {
    font-size: clamp(46px, 14.5vw, 62px);
    line-height: 1;
  }

  .maker {
    font-size: 26px;
  }

  .class-grid,
  .weapon-grid,
  .database-grid {
    grid-template-columns: 1fr;
  }

  .result-header {
    align-items: flex-start;
  }
}
