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

body {
  background: black;
  color: white;
  font-family: Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

/* ===================================
   INTRO
   =================================== */

.intro {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: black;
  transition: opacity 1.8s ease;
}

.lane {
  position: absolute;
  width: max-content;
  display: flex;
  gap: 0.5vw;
  align-items: center;
}

.lane img {
  height: 24vh;
  width: auto;
  flex-shrink: 0;
}

.lane-1 { top: 1%; }
.lane-2 { top: 26%; }
.lane-3 { top: 51%; }
.lane-4 { top: 76%; }

/* ===================================
   MAIN
   =================================== */

.main-new {
  width: 100vw;
  height: 300vh;
  position: relative;
}

.main-new-sticky {
  position: sticky;
  top: 0;
  width: 100vw;
  height: 100vh;
}

.main-new-title {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 16px;
  font-weight: normal;
  font-family: Helvetica, Arial, sans-serif;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.main-new button {
  position: absolute;
  background: transparent;
  color: white;
  border: 1px solid white;
  padding: 4px 8px;
  font-size: 12px;
  font-family: Helvetica, Arial, sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s ease, color 0.2s ease;
}

.main-new button:hover {
  background: white;
  color: black;
}

.btn-a { top: 80px; left: 30px; }
.btn-b { top: 80px; right: 30px; }
.btn-c { bottom: 30px; left: 30px; }
.btn-d { bottom: 30px; right: 30px; }

/* ===================================
   GRID SECTION
   wave + selection 합쳐진 섹션
   480vh = wave 380vh + selection 100vh
   =================================== */

.grid-section {
  width: 100vw;
  height: 530vh; /* 480vh + 50vh 여백 */
}

.grid-sticky {
  position: sticky;
  top: 0;
  width: 100vw;
  height: 100vh;
  /* 두 그리드를 겹치기 위해 relative */
  position: sticky;
}

/* ===================================
   WAVE GRID
   =================================== */

.wave-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: repeat(28, 1fr);
  grid-template-rows: repeat(15, 1fr);
  gap: 5px;
  padding: 10px;
  /* 기본: 보임 */
  opacity: 1;
  transition: opacity 0.4s ease;
}

/* ===================================
   SELECTION GRID
   =================================== */

.selection-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: repeat(28, 1fr);
  grid-template-rows: repeat(15, 1fr);
  gap: 5px;
  padding: 10px;
  /* 기본: 숨김, JS로 전환 */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

/* 셀렉션 활성 상태 */
.selection-grid.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===================================
   CUBE
   =================================== */

.cube {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  transition:
    transform 0.35s ease,
    background-color 0.4s ease,
    border-color 0.4s ease;
}

.wave-grid .cube {
  pointer-events: none;
}

.selection-grid .cube:hover {
  background: white;
  border-color: white;
  transform: scale(1.08);
  cursor: pointer;
}

.selection-grid .cube.selected {
  background: white;
  border-color: white;
}

/* ===================================
   SAVE UI
   =================================== */

.save-ui {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.save-ui.visible {
  opacity: 1;
  pointer-events: auto;
}

.save-ui input {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.9);
  color: white;
  padding: 8px 12px;
  width: 140px;
  outline: none;
  font-size: 12px;
  font-family: Helvetica, Arial, sans-serif;
  letter-spacing: 0.08em;
}

.save-ui input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.save-ui button {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  font-size: 12px;
  font-family: Helvetica, Arial, sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.save-ui button:hover {
  background: white;
  color: black;
}
