:root {
  --bg-primary: #0f172a;
  --bg-secondary: rgba(30, 41, 59, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-cyan: #06b6d4;
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --transition: all 0.3s ease;
}

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

@font-face {
  font-family: 'Paperlogy';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-3Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Paperlogy';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-4Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Paperlogy';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-7Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Paperlogy';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-8ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: 'Paperlogy', 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

@keyframes rotateAurora {
  from { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  to { transform: rotate(360deg) scale(1); }
}

.animated-gradient-bg {
  position: fixed;
  top: -50vh;
  left: -50vw;
  width: 200vw;
  height: 200vh;
  /* 3가지 이상의 다채로운 색상 조합 */
  background: conic-gradient(
    from 180deg at 50% 50%,
    #ff9a9e 0deg,
    #c2e9fb 90deg,
    #a1c4fd 180deg,
    #fecfef 270deg,
    #ff9a9e 360deg
  );
  filter: blur(120px);
  animation: rotateAurora 25s linear infinite;
  will-change: transform;
  z-index: -1;
}

/* Animated Tapes Background for Entry View */
.entry-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: -2;
  overflow: hidden;
  background: #fdfdff;
}

.entry-bg-mesh {
  position: absolute;
  top: -30%;
  left: -30%;
  width: 160%;
  height: 160%;
  background: 
    radial-gradient(circle at 30% 35%, #ff7eb9 0%, rgba(255, 126, 185, 0) 55%),
    radial-gradient(circle at 75% 30%, #2bf0cc 0%, rgba(43, 240, 204, 0) 55%),
    radial-gradient(circle at 45% 70%, #ffc837 0%, rgba(255, 200, 55, 0) 60%),
    linear-gradient(135deg, #a18cd1 0%, #3a7bd5 100%);
  background-size: 150% 150%;
  filter: url(#liquid-noise);
  will-change: filter, background-position;
  opacity: 1;
  animation: bgPan 25s infinite ease-in-out alternate;
}

@keyframes bgPan {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

#app {
  width: 100%;
  max-width: 1200px;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.glass-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 2.5rem;
  width: 100%;
  max-width: 500px;
  animation: fadeIn 0.5s ease-out;
}

.glass-panel.large {
  max-width: 900px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

@keyframes elasticPop {
  0% { transform: scale(0); }
  40% { transform: scale(1.1); }
  60% { transform: scale(0.9); }
  80% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.hidden {
  display: none !important;
}

.fade-out {
  animation: fadeOut 0.4s ease-in forwards;
}

h1, h2, h3 {
  margin-bottom: 1rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h1 {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.dropdown-container {
  position: relative;
}

.dropdown-list {
  position: absolute;
  top: calc(100% + 2px); /* right below the border */
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  max-height: 14.5rem; /* 약 4.5개 아이템이 보이도록 설정하여 스크롤 암시 */
  overflow-y: auto;
  z-index: 100;
  margin-top: 0;
  box-shadow: none;
  -ms-overflow-style: none;  /* IE and Edge 스크롤바 숨김 */
  scrollbar-width: none;  /* Firefox 스크롤바 숨김 */
}

.dropdown-list::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera 스크롤바 숨김 */
}

.dropdown-item {
  padding: 1rem 1.5rem;
  cursor: pointer;
  color: #000;
  font-family: 'Paperlogy', sans-serif;
  font-weight: 500;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover, .dropdown-item.active {
  background: rgba(0, 0, 0, 0.05);
  color: #000;
}

.radio-group {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 0;
}

.radio-group input[type="radio"] {
  accent-color: var(--accent-color);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-cyan));
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px var(--accent-cyan);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Game View Specifics */
.color-display {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.color-box-wrapper {
  text-align: center;
}

.color-box {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  box-shadow: 0 0 30px rgba(0,0,0,0.3);
  margin-bottom: 1rem;
  transition: background-color 0.1s;
}

.color-sliders {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-group span {
  width: 20px;
  font-weight: 600;
}

input[type="range"] {
  flex-grow: 1;
  -webkit-appearance: none;
  height: 8px;
  border-radius: 4px;
  background: #334155;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px;
  height: 60px;
  border-radius: 0;
  background: #fff;
  cursor: grab;
  box-shadow: none;
  mix-blend-mode: difference;
}

input[type="range"]::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.phase-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius);
  z-index: 100;
}

.phase-text {
  font-size: 4rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 20px var(--accent-cyan);
  animation: popInOut 1s ease-in-out;
}

@keyframes popInOut {
  0% { opacity: 0; transform: scale(0.5); }
  30% { opacity: 1; transform: scale(1.2); }
  50% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* ScoreBoard Specifics */
.scoreboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .scoreboard-grid {
    grid-template-columns: 1fr;
  }
}

.score-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1.5rem;
}

.score-card h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.5rem;
}

.rank-list {
  list-style: none;
}

.rank-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid;
  border-bottom-color: color-mix(in srgb, currentColor 15%, transparent);
  font-size: 0.95rem;
  color: inherit;
}

.rank-item:last-child {
  border-bottom: none;
}

.rank-item .rank-num {
  font-weight: 900;
  font-size: 1.2em;
  color: inherit;
  opacity: 0.85;
  width: 32px;
  min-width: 32px;
  margin-right: 0.5rem;
  text-align: right;
}

.rank-item .rank-name {
  flex-grow: 1;
  padding-left: 0.3rem;
}

.rank-item .rank-score {
  font-weight: 800;
  padding-left: 0.5rem;
  white-space: nowrap;
}

/* === NEW: Memorize Phase Text === */
.memorize-hint {
  position: absolute;
  top: clamp(1rem, 5vh, 3rem);
  right: clamp(1rem, 5vw, 3rem);
  font-family: 'Paperlogy', sans-serif;
  font-weight: 300;
  font-size: clamp(2rem, 8vw, 3.5rem);
  text-align: right;
  z-index: 1001;
  /* color will be set dynamically via JS */
}

/* === NEW: Custom DOM Vertical Sliders === */
.vertical-sliders-container {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  display: flex;
  flex-direction: row;
  gap: clamp(15px, 3vw, 25px);
  padding-left: clamp(15px, 3vw, 25px);
  z-index: 10;
}

.game-box-container {
  position: absolute;
  top: 5vh; bottom: 5vh;
  left: 5vw; right: 5vw;
  border-radius: 40px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Fix for WebKit overflow:hidden + border-radius + mix-blend-mode bug */
  isolation: isolate;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.1);
}

.game-box-container::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 40px;
  pointer-events: none;
  z-index: 50;
}

.custom-v-slider-wrapper {
  width: clamp(30px, 8vw, 50px); /* Narrower width for the track */
  height: 100%;
  position: relative;
}

.slider-bg {
  position: absolute;
  top: 4vh; bottom: 4vh; /* padding from top/bottom */
  left: 50%;
  width: 16px; /* Thick track */
  transform: translateX(-50%);
  border-radius: 16px;
  border: 2px solid #000;
  box-shadow: 3px 3px 0 rgba(0,0,0,1);
  pointer-events: none;
}

#hue-bg {
  background: linear-gradient(to top, 
    #ff0000 0%, #ffff00 17%, #00ff00 33%, 
    #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}

.slider-thumb {
  position: absolute;
  left: 50%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #000;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  box-shadow: 4px 4px 0 rgba(0,0,0,1);
  transition: transform 0.1s ease-out;
}

.slider-touch-area {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 3;
  cursor: pointer;
  touch-action: none; /* Prevent scrolling on mobile while sliding */
}

.submit-minimal-btn {
  position: absolute;
  bottom: clamp(1rem, 5vh, 3rem);
  right: clamp(1rem, 5vw, 3rem);
  font-family: 'Paperlogy', sans-serif;
  color: #fff;
  background: #000; /* Will be overridden dynamically in JS */
  border: none;
  padding: 0.8rem 3.5rem;
  min-height: 75px;
  border-radius: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 1001;
  text-transform: uppercase;
  transition: transform 0.1s, opacity 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.submit-minimal-btn .btn-main-text {
  font-weight: 900;
  font-size: clamp(1.4rem, 3.2vh, 1.8rem);
  letter-spacing: 2px;
  line-height: 1.1;
}

.submit-minimal-btn .btn-sub-text {
  font-weight: 600;
  font-size: clamp(0.8rem, 1.8vh, 1rem);
  letter-spacing: 1px;
  line-height: 1;
  opacity: 0.85;
}

.submit-minimal-btn:hover {
  transform: translateY(-4px);
  opacity: 0.9;
}

.submit-minimal-btn:active {
  transform: translateY(2px);
  opacity: 1;
}

.score-result {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 2rem;
}

/* New Magazine Style Classes */
.full-screen-color {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100%;
  z-index: 1000;
  /* transition is optional, but helps with fading */
  transition: opacity 0.5s ease;
}

.split-screen-result {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  z-index: 2000;
  overflow-y: auto;
  overflow-x: hidden;
}

.split-screen-half {
  position: fixed;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
}

.split-screen-half:nth-child(2) {
  left: 50%;
}

.magazine-overlay {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto;
  padding: clamp(1.5rem, 4vh, 3rem);
  padding-bottom: 6rem;
  box-sizing: border-box;
}

.magazine-content {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: flex-start;
}

.magazine-score {
  font-size: clamp(5rem, 18vw, 20rem);
  font-weight: 800;
  color: inherit;  /* JS 인라인 color를 상속받음 — #fff 하드코딩 금지 */
  line-height: 0.9;
  text-align: center;
  flex-shrink: 0;
  margin: 3vh 0;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.magazine-scoreboard {
  background: transparent;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: clamp(1.5rem, 3vh, 2.5rem) 0;
  border: none;
  border-radius: 0;
  width: 100%;
  pointer-events: auto;
  flex-shrink: 0;
}

.magazine-scoreboard h3 {
  font-size: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.5rem;
  color: inherit;
  background: none;
  -webkit-text-fill-color: inherit;
  text-align: left;
}

/* === NEW: Magazine Entry Screen === */
.magazine-entry {
  width: 100vw;
  height: 100vh; /* Force it to fit */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 5vh 10vw;
  box-sizing: border-box;
  overflow-y: auto; /* Prevent scrolling but allow y-scroll if form is tall */
  overflow-x: hidden;
}



/* ═══════════════════════════════════════════════════════════════════════════
 * ⛔ .magazine-title — 절대 수정 금지 (HARNESS LOCK)
 * ═══════════════════════════════════════════════════════════════════════════
 * 
 * 이 규칙의 동작 원리:
 *   1. 글로벌 h1 규칙(line 174)이 -webkit-text-fill-color: transparent 를 적용함
 *   2. -webkit-text-fill-color: transparent 는 어떤 color 속성보다 우선함
 *   3. 따라서 color: #000 등으로 바꿔도 텍스트는 투명한 채로 유지됨
 *   4. mix-blend-mode: difference + color: #fff 조합이 투명 텍스트를
 *      배경과 블렌딩하여 시각적으로 보이게 만듦
 *   5. filter: contrast + saturate + brightness 가 블렌딩 결과를 선명하게 증폭
 *
 * ⚠️ 수정 시 반드시 확인할 것:
 *   - mix-blend-mode 를 제거하면 텍스트가 완전히 사라짐
 *   - filter 를 제거하면 텍스트 대비가 매우 약해짐
 *   - color 를 #fff 이외로 변경하면 블렌딩 결과가 예측 불가능해짐
 *   - -webkit-text-fill-color: initial 은 일부 브라우저에서 transparent 로 해석됨
 *     하지만 mix-blend-mode: difference 와 함께 사용하면 정상 작동
 *
 * ⚠️ 서버 캐시 주의:
 *   - server/index.js 의 maxAge 설정으로 인해 CSS/JS 변경이 즉시 반영되지 않을 수 있음
 *   - 변경 후 반드시 서버 재시작 + Ctrl+Shift+R 강력 새로고침 필요
 *   - index.html 의 ?v= 쿼리 파라미터를 업데이트해야 캐시 무효화됨
 *
 * 마지막 검증: 2026-05-21 (commit 28f6f2c)
 * ═══════════════════════════════════════════════════════════════════════════ */
.magazine-title {
  font-family: 'Paperlogy', sans-serif;
  font-weight: 800;
  font-size: clamp(3rem, 10vh, 10vw);
  line-height: 0.9;
  letter-spacing: -0.02em;
  margin-bottom: max(2vh, 1rem);
  text-align: left;
  
  /* ⛔ 아래 3줄은 반드시 세트로 유지 — 하나라도 제거하면 타이틀 사라짐 */
  color: #fff !important;
  mix-blend-mode: difference;
  filter: contrast(200%) saturate(120%) brightness(150%);
  
  /* 글로벌 h1 그라디언트 배경 무력화 */
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: initial;
}

@keyframes gradientText {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animated-gradient-text {
  background: linear-gradient(
    45deg,
    #fff0f0,
    #f0fff0,
    #f0f0ff,
    #fffff0,
    #ffffff
  );
  background-size: 300% 300%;
  animation: gradientText 8s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.entry-form {
  width: 100%;
  max-width: 600px;
}

.entry-form .form-group {
  margin-bottom: max(2vh, 1.5rem);
}

input[type="text"].minimal-input {
  width: 100%;
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid rgba(0,0,0,0.5) !important;
  color: rgba(0, 0, 0, 0.85) !important;
  font-family: 'Paperlogy', 'Inter', sans-serif;
  font-size: clamp(1rem, 3vh, 1.5rem);
  padding: max(1vh, 0.5rem) 0;
  margin-bottom: 0;
  outline: none;
  transition: border-color 0.3s;
  border-radius: 0 !important;
}

input[type="text"].minimal-input::placeholder {
  color: transparent; /* custom-placeholder를 대신 사용 */
}

input[type="text"].minimal-input:focus {
  border-bottom-color: rgba(0,0,0,0.8) !important;
  box-shadow: none !important;
}

/* Animated Custom Placeholder */
.custom-placeholder {
  position: absolute;
  left: 0;
  top: 0;
  padding: max(1vh, 0.5rem) 0;
  font-family: 'Paperlogy', 'Inter', sans-serif;
  font-size: clamp(1rem, 3vh, 1.5rem);
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0.4), rgba(255,255,255,0.9), rgba(255,255,255,0.4));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientPlaceholder 3s ease infinite;
  transition: opacity 0.3s ease;
}

@keyframes gradientPlaceholder {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}



.blink-cursor {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  margin-left: 4px;
  -webkit-text-fill-color: rgba(255,255,255,0.8);
  animation: blinkCursor 1s step-end infinite;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

input.minimal-input:focus + .custom-placeholder,
input.minimal-input:not(:placeholder-shown) + .custom-placeholder {
  opacity: 0;
}

.difficulty-group {
  margin-bottom: max(2vh, 1.5rem);
}

.diff-label {
  display: block;
  font-family: 'Paperlogy', sans-serif;
  font-weight: 300;
  font-size: clamp(0.9rem, 2vh, 1.2rem);
  color: #000;
  margin-bottom: max(1vh, 0.5rem);
}

.radio-group.clean {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap; /* Allows wrapping on smaller screens */
}

.radio-group.clean label {
  font-family: 'Paperlogy', sans-serif;
  font-weight: 400;
  font-size: clamp(0.9rem, 2.5vh, 1.2rem);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.radio-group.clean input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid #000;
  border-radius: 50%;
  outline: none;
  transition: all 0.2s;
  position: relative;
  cursor: pointer;
  margin: 0;
}

.radio-group.clean input[type="radio"]:checked {
  border-color: #000;
}

.radio-group.clean input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: #000;
  border-radius: 50%;
}

.magazine-start-btn {
  font-family: 'Paperlogy', sans-serif;
  font-weight: 800;
  font-size: clamp(1.1rem, 2.5vh, 1.4rem);
  color: #fff !important;
  background: #000 !important;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.3s, background 0.3s;
  text-transform: uppercase;
  margin-top: max(1vh, 0.5rem);
  letter-spacing: 3px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.magazine-start-btn:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed;
  transform: none !important;
  background: #000000 !important;
  color: #ffffff !important;
}

.magazine-start-btn:not(:disabled) {
  background: #ffffff !important;
  color: #000000 !important;
  mix-blend-mode: difference;
}

.magazine-start-btn:not(:disabled):hover {
  transform: translateY(-4px);
  opacity: 0.9;
}

.magazine-start-btn:not(:disabled):active {
  transform: translateY(2px);
  opacity: 1;
}

/* === Responsive Adjustments === */
@media (max-width: 768px) {
  .magazine-entry {
    padding: 8vw;
    padding-top: 8vh;
    padding-bottom: 8vh;
  }
  
  .magazine-title {
    font-size: 16vw;
    margin-bottom: 2rem;
  }
  
  input[type="text"].minimal-input {
    font-size: 1.2rem;
    padding: 0.8rem 0;
    margin-bottom: 2rem;
  }
  
  .diff-label {
    font-size: 1rem;
  }
  
  .radio-group.clean label {
    font-size: 1rem;
  }
  
  .magazine-start-btn {
    font-size: 1.1rem;
    width: 100%;
    padding: 1rem 2rem;
    min-height: 56px;
  }
  
  /* 모바일 세로 화면에서는 슬라이더들이 너무 많은 자리를 차지하지 않도록 폭만 줄여줍니다 (세로 UI 유지) */
  .custom-v-slider-wrapper {
    width: clamp(20px, 8vw, 40px);
  }
}

@keyframes double-bounce {
  0% { transform: scale(0.5); opacity: 0; }
  30% { transform: scale(1.3); opacity: 1; }
  60% { transform: scale(0.9); }
  80% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.anim-double-bounce {
  animation: double-bounce 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes score-impact {
  0% { transform: scale(1); }
  30% { transform: scale(1.2); text-shadow: 0 0 20px rgba(255,255,255,0.8); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); text-shadow: none; }
}

.anim-score-impact {
  display: inline-block;
  animation: score-impact 0.5s ease-out forwards;
}

/* 공유 카드 미리보기 모달 애니메이션 */
@keyframes shareCardPop {
  0% { opacity: 0; transform: scale(0.9) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

#copy-url-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(118,75,162,0.5);
}

#share-close-btn:hover {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
}

/* 중앙 슬라이더 래퍼 및 블러 영역 */
.slider-panel-wrapper {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 25%;
  width: 50%;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
  border: none;
  box-shadow: none;
}

.slider-panel-blur {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(80px);
  -webkit-backdrop-filter: blur(80px);
  background: transparent;
  z-index: 5;
}

/* 모바일 대응 미디어 쿼리 (가로폭이 좁은 기기) */
@media (max-width: 768px) {
  .slider-panel-wrapper {
    left: 15%;
    width: 70%;
  }
}

@media (max-width: 480px) {
  .slider-panel-wrapper {
    left: 10%;
    width: 80%;
  }
}

/* === Rotary Dials UI === */
.dials-container {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1.2rem, 4vw, 3rem);
  z-index: 10;
  pointer-events: none;
  padding-bottom: 2rem;
}

.dial-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.dial-knob {
  position: relative;
  width: clamp(90px, 12vw, 130px);
  height: clamp(90px, 12vw, 130px);
  border-radius: 50%;
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: grab;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.dial-knob:active {
  cursor: grabbing;
}

.dial-wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: none;
}

/* 다이얼별 그라데이션 테마 */
#dial-wheel-h {
  background: conic-gradient(
    from 0deg,
    #ff0000 0%,
    #ffff00 17%,
    #00ff00 33%,
    #00ffff 50%,
    #0000ff 67%,
    #ff00ff 83%,
    #ff0000 100%
  );
}

#dial-wheel-s {
  /* JS에서 현재 Hue값 기준으로 동적 갱신 예정 */
  background: conic-gradient(from 0deg, #808080, #ff0000);
}

#dial-wheel-b {
  /* 명도는 검정 -> 원색 -> 흰색 */
  background: conic-gradient(from 0deg, #000000, #ff0000, #ffffff);
}

.dial-indicator-arrow {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  color: #ffffff;
  margin-bottom: -0.3rem;
  z-index: 10;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: center 30%;
  transition: transform 0.05s ease-out;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}



.dial-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(24px, 3.5vw, 36px);
  height: clamp(24px, 3.5vw, 36px);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  background: transparent;
  pointer-events: none;
  font-size: 0;
  color: transparent;
  z-index: 5;
  transition: background 0.2s ease;
}

/* 모바일 세로 좁은 화면 가로 배열 보장 */
@media (max-width: 480px) {
  .dials-container {
    gap: 0.6rem;
  }
  .dial-knob {
    width: 76px;
    height: 76px;
  }
}

/* === START BUTTON: Enforce Active mix-blend-mode: difference === */
.magazine-start-btn {
  font-family: 'Paperlogy', sans-serif !important;
  font-weight: 800 !important;
  font-size: 1.1rem !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  transition: transform 0.1s, opacity 0.3s, background 0.3s, box-shadow 0.3s !important;
  
  /* 버튼 형태(레이아웃) 붕괴 방지용 필수 속성 강제 복구 */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 56px !important;
  padding: 0.8rem 2.5rem !important;
  margin-top: 1.5rem !important;
  box-sizing: border-box !important;
  
  /* 폰트 깨짐 및 mix-blend-mode 서브픽셀 아티팩트 방지 */
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
}

.magazine-start-btn:disabled {
  /* ═══ 반투명 유리(Frosted Glass) — 절대 변경 금지 ═══ */
  /* ⚠️ mix-blend-mode: difference 사용 금지! backdrop-filter와 충돌하여 블러가 사라짐 */
  background: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(20px) saturate(130%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(130%) !important;
  color: rgba(255, 255, 255, 0.5) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
  transform: none !important;
  mix-blend-mode: normal !important;  /* ← difference 절대 금지 */
  isolation: isolate !important;
  border-radius: 9999px !important;
}

.magazine-start-btn:not(:disabled) {
  /* ═══ 활성화 유리 — 절대 변경 금지 ═══ */
  /* ⚠️ mix-blend-mode: difference 사용 금지! backdrop-filter와 충돌 */
  background: var(--btn-bg, rgba(255, 255, 255, 0.2)) !important;
  backdrop-filter: blur(20px) saturate(130%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(130%) !important;
  color: var(--btn-color, #ffffff) !important;
  border: 1.5px solid var(--btn-border, rgba(255, 255, 255, 0.7)) !important;
  box-shadow: none !important;
  mix-blend-mode: normal !important;  /* ← difference 절대 금지 */
  isolation: isolate !important;
  opacity: 1 !important;
  border-radius: 9999px !important;
  
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  transform: none !important;
}

.magazine-start-btn:not(:disabled):hover {
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.3)) !important;
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15) !important;
}

.magazine-start-btn:not(:disabled):active {
  transform: translateY(1px) !important;
  opacity: 1 !important;
}

/* === SCOREBOARD CONTENT: JS 기반 대비색(getContrastYIQ) 사용 === */
/* mix-blend-mode: difference 제거 — JS에서 배경 명도를 계산하여 */
/* 텍스트에 직접 #000 또는 #fff를 지정하므로 CSS 블렌딩 불필요 */
.split-screen-result .magazine-content {
  /* blend mode 없음 — JS 인라인 color가 그대로 적용됨 */
}

/* 안티앨리어싱 서브픽셀 아티팩트 깨짐 현상 방지 (color 강제 제거) */
.split-screen-result .magazine-content * {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
}

/* 랭크 및 스코어 카드 테두리 선 — currentColor를 상속받아 자동 대비 */
.split-screen-result .magazine-content .score-card {
  border-top-color: currentColor !important;
}

/* rank-item: backdrop-filter blur를 보호하기 위해 독립 스태킹 컨텍스트 생성 */
.split-screen-result .magazine-content .rank-item {
  border-color: rgba(128, 128, 128, 0.4) !important;
  isolation: isolate;
}

/* rank-item 내부 텍스트 — 부모의 color를 상속 */
.split-screen-result .magazine-content .rank-item * {
  color: inherit !important;
}

