/* ============================= */
/* Fonts */
/* ============================= */
@font-face {
  font-family: 'GoryeongStrawberry';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_2304-01@1.0/GoryeongStrawberry.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

/* ============================= */
/* ✅ Warm Paper + Ink Theme Tokens */
/* ============================= */
:root {
  --bg0: #fbf6ea;         /* warm paper */
  --bg1: #f0e6d5;         /* deeper paper */
  --panel: rgba(255,255,255,0.65);
  --panel-2: rgba(255,255,255,0.78);
  --border: rgba(40,36,30,0.14);
  --border-strong: rgba(40,36,30,0.22);
  --shadow: 0 10px 26px rgba(40,36,30,0.18);
  --shadow-soft: 0 8px 18px rgba(40,36,30,0.14);
  --text: rgba(35,32,28,0.94);      /* ink */
  --text-dim: rgba(35,32,28,0.74);
  --focus: #3558b7;       /* ink-blue (pen) */
  --highlight: rgba(53,88,183,0.16);
  --success: #1f7a4a;     /* deep green */
  --danger: #b93a4f;      /* deep rose */
  --gold: #b9892d;        /* warm marker */
}

/* ============================= */
/* Base Layout */
/* ============================= */
body { 
  font-family: 'Noto Sans KR', sans-serif;
  margin: 0; padding: 0; height: 100vh; box-sizing: border-box;
  display: flex; justify-content: center; align-items: center;
  background:
    radial-gradient(1100px 760px at 18% 14%, rgba(255,255,255,0.75), rgba(255,255,255,0) 60%),
    radial-gradient(900px 620px at 85% 78%, rgba(0,0,0,0.04), rgba(0,0,0,0) 58%),
    linear-gradient(135deg, var(--bg0) 0%, var(--bg1) 60%, #efe3cf 100%);
}

.container { 
  display: flex; width: 90vw; height: 86vh; gap: 20px; align-items: flex-start;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.52));
  border: 1px solid var(--border);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 20px; border-radius: 18px; box-shadow: var(--shadow);
}

/* ============================= */
/* ✅ 상단 네비게이션 메뉴 (중앙 정렬 & 버튼화 강조) */
/* ============================= */
.top-nav {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 12px 30px;
  box-sizing: border-box;
  display: flex;
  justify-content: center; /* ✨ 메뉴를 화면 중앙으로 정렬 */
  align-items: center;
  background: rgba(255, 255, 255, 0.65); /* 투명도를 살짝 낮춰서 더 또렷하게 */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-strong);
  z-index: 100;
  box-shadow: 0 4px 20px rgba(40, 36, 30, 0.06); /* 그림자를 살짝 키워 입체감 부여 */
}

.nav-home-link {
  text-decoration: none;
  color: var(--focus); /* ✨ 기본 텍스트를 눈에 띄는 잉크 블루 색상으로 */
  font-weight: 800; /* 글씨를 더 굵게 */
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 22px; /* ✨ 클릭하기 편하도록 여백 추가 */
  background: rgba(255, 255, 255, 0.8); /* 은은한 흰색 배경 */
  border: 1px solid rgba(53, 88, 183, 0.25); /* 파란색 테두리 */
  border-radius: 30px; /* ✨ 둥근 알약(Pill) 모양으로 버튼화 */
  box-shadow: 0 2px 10px rgba(53, 88, 183, 0.1);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-home-link:hover {
  background: var(--focus); /* 마우스를 올리면 짙은 파란색 배경으로 전환 */
  color: #ffffff; /* 텍스트는 흰색으로 */
  border-color: var(--focus);
  transform: translateY(-2px); /* 살짝 위로 떠오르는 효과 */
  box-shadow: 0 6px 18px rgba(53, 88, 183, 0.25);
}

.nav-home-link:hover .nav-icon {
  transform: translateX(-4px); /* 마우스를 올리면 화살표가 왼쪽으로 튕기는 애니메이션 */
}

.nav-icon {
  font-size: 18px;
  transition: transform 0.2s ease;
}

/* ============================= */
/* Grid & Cells */
/* ============================= */
.grid { 
  display: grid;
  width: min(50%, calc(90vh - 40px)); 
  aspect-ratio: 1; box-sizing: border-box; 
  gap: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.35));
  border: 1px solid var(--border);
  padding: 10px; border-radius: 14px; box-shadow: var(--shadow-soft);
}

.cell-wrapper { position: relative; width: 100%; aspect-ratio: 1; }

.cell { 
  position: absolute; inset: 0; text-align: center; font-size: calc(2.0vw + 2.0vh);
  background:
    radial-gradient(160% 120% at 30% 18%, rgba(255,255,255,0.90), rgba(255,255,255,0) 55%),
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(240,230,213,0.65));
  border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text);
  box-sizing: border-box; text-shadow: 0 1px 0 rgba(255,255,255,0.55);
  transition: border-color .2s, background-color .2s, transform .15s, box-shadow .2s;
}

.cell:hover { border-color: rgba(53,88,183,0.55); box-shadow: 0 10px 18px rgba(40,36,30,0.18); transform: translateY(-1px); }

.cell:focus {
  outline: none; background-color: rgba(255, 235, 59, 0.75) !important; 
  border-color: #e53935 !important; 
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2), 0 10px 18px rgba(40, 36, 30, 0.18);
  transform: scale(1.1); z-index: 10;
}

.cell.highlight {
  background-color: rgba(33, 150, 243, 0.15) !important; 
  background-image: none; border-color: #2196f3 !important;
  box-shadow: inset 0 0 0 1px rgba(33, 150, 243, 0.3); font-weight: 800;
}

.cell.filled{
  background: #9f8080; border-color: rgba(53,88,183,0.55);
  box-shadow: inset 0 0 0 2px rgba(53,88,183,0.10);
}

.cell-number { 
  position: absolute; top: 6%; left: 6%; font-size: calc(0.5vw + 0.5vh);
  color: var(--text-dim); z-index: 1; text-shadow: none;
}

/* ============================= */
/* 🎮 Game Stats (Score & Combo) */
/* ============================= */
.game-stats {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel-2); padding: 12px 20px;
  border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-soft);
  margin-bottom: -5px;
}
.score-box { font-size: 22px; font-weight: 900; color: var(--text); display: flex; align-items: center; gap: 8px; }
.score-val { color: var(--focus); }
.combo-box {
  font-family: 'GoryeongStrawberry', sans-serif;
  font-size: 26px; font-weight: 900; color: var(--danger);
  opacity: 0; transform: scale(0.8); transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.combo-box.active { opacity: 1; transform: scale(1); animation: comboPop 0.4s ease-out; }

@keyframes comboPop {
  0% { transform: scale(0.5) rotate(-10deg); }
  50% { transform: scale(1.3) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* 플로팅 스코어 (화면에 둥둥 뜨는 텍스트) */
.floating-score {
  position: absolute; font-weight: 900; font-size: 24px; pointer-events: none; z-index: 9999;
  text-shadow: 0 2px 4px rgba(255,255,255,0.8);
  animation: floatUp 1s ease-out forwards;
}
.floating-score.plus { color: var(--success); }
.floating-score.minus { color: var(--danger); }
@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(0.8); }
  10% { transform: translateY(-5px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-50px) scale(1); }
}

/* ❌ 오답 시 화면 흔들림 효과 */
.shake { animation: gridShake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes gridShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); border-color: var(--danger) !important; }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
  40%, 60% { transform: translate3d(8px, 0, 0); }
}

/* ============================= */
/* Clue / Right Panel Area */
/* ============================= */
.clue-container { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.file-name { font-size: calc(1.4vw + 1.4vh); color: var(--text); font-weight: 900; text-align: center; text-shadow: 0 1px 0 rgba(255,255,255,0.6); }

/* ============================= */
/* Simple Panel (힌트 패널) */
/* ============================= */
.simple-panel { background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.55)); border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px; box-shadow: 0 10px 22px rgba(40,36,30,0.16); }
#simple-panel .simple-hint {
  font-size: 50px; line-height: 1.12; font-weight: 900; letter-spacing: -0.02em; text-align: center; white-space: pre-wrap; word-break: keep-all;
  color: rgba(33,30,26,0.94); text-shadow: 0 1px 0 rgba(255,255,255,0.65); position: relative; overflow: hidden; padding: 14px 16px; border-radius: 16px;
  background: radial-gradient(160% 120% at 28% 18%, rgba(255,255,255,0.95), rgba(255,255,255,0) 58%), linear-gradient(180deg, rgba(255,255,255,0.82), rgba(240,230,213,0.70));
  border: 1px solid rgba(40,36,30,0.18); animation: simpleHintPulse 1.7s ease-in-out infinite;
}
#simple-panel .simple-hint::after {
  content:""; position:absolute; top:-30%; left:-60%; width:40%; height:160%; transform: skewX(-18deg);
  background: linear-gradient(to right, rgba(185,137,45,0) 0%, rgba(185,137,45,0.35) 50%, rgba(185,137,45,0) 100%);
  animation: simpleHintShine 2.8s ease-in-out infinite; pointer-events:none;
}

/* ============================= */
/* Pick Panel */
/* ============================= */
.pick-panel { padding: 15px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--border); box-shadow: var(--shadow-soft); }
.pick-row { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.pick-label { width: 40px; font-weight: 800; font-size: 14px; color: var(--text-dim); }
.pick-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-buttons button { min-width: 42px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg0); color: var(--text); font-weight: 800; cursor: pointer; transition: all 0.2s ease-in-out; }
.pick-buttons button:hover { background: var(--bg1); transform: translateY(-1px); box-shadow: 0 4px 8px rgba(40,36,30,0.1); }
.pick-buttons button.active { outline: 2px solid var(--focus); border-color: var(--focus); background: var(--highlight); color: var(--focus); }
.pick-buttons button.solved { background-color: rgba(31,122,74,0.1); border-color: var(--success); color: var(--success); }
.pick-buttons button.solved.active { outline: 2px solid var(--success); }
.pick-input { display: flex; gap: 8px; align-items: center; margin-top: 15px; flex-wrap: wrap; }
.pick-input button { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg0); color: var(--text); font-weight: 800; cursor: pointer; transition: background 0.2s; }
.pick-input button:hover { background: var(--bg1); }
.pick-msg { margin-top: 10px; font-size: 15px; font-weight: 800; color: var(--danger); }

/* ============================= */
/* Next Game Bar */
/* ============================= */
.next-game-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.next-game-bar select, .next-game-bar button { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg0); color: var(--text); font-family: inherit; font-weight: bold; cursor: pointer; }
.next-game-bar select { min-width: 200px; flex: 1; }
.next-game-bar button:hover, .next-game-bar select:hover { background: var(--bg1); }

/* ============================= */
/* Animations */
/* ============================= */
@keyframes simpleHintPulse { 0% { transform: scale(1); } 40% { transform: scale(1.03); } 65% { transform: scale(1.015); } 100% { transform: scale(1); } }
@keyframes simpleHintShine { 0% { left:-65%; opacity:0; } 35% { opacity:0; } 55% { opacity:0.9; } 70% { opacity:0; } 100% { left:130%; opacity:0; } }
.flipped-letter { animation: flipInSmooth 0.6s cubic-bezier(0.68,-0.55,0.27,1.55) forwards; }
@keyframes flipInSmooth { 0% { transform: rotateY(90deg) scale(0.8); opacity:0; } 40% { transform: rotateY(-10deg) scale(1.08); opacity:.75; } 70% { transform: rotateY(10deg) scale(1); opacity:.92; } 100% { transform: rotateY(0) scale(1); opacity:1; } }

/* ============================= */
/* ✅ 성공 연출: 황금빛 반짝임과 글자 물결 (Golden Wave) */
/* ============================= */
.grid.golden-glow { border-color: var(--gold) !important; box-shadow: 0 0 25px rgba(185, 137, 45, 0.4), inset 0 0 15px rgba(185, 137, 45, 0.15) !important; transition: all 1.2s ease-in-out; }
.cell.wave { animation: textWave 0.7s ease-in-out forwards; }
@keyframes textWave { 0% { transform: translateY(0) scale(1); color: var(--text); } 40% { transform: translateY(-12px) scale(1.15); color: var(--gold); text-shadow: 0 4px 10px rgba(185,137,45,0.6); } 70% { transform: translateY(3px) scale(0.95); color: var(--gold); } 100% { transform: translateY(0) scale(1); color: var(--text); text-shadow: 0 1px 0 rgba(255,255,255,0.55); } }

/* ============================= */
/* Reddit Invite Banner */
/* ============================= */
.reddit-invite-banner {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: auto; /* 상단 요소들이 공간을 차지하고 남은 공간의 맨 아래로 밀어냄 */
  padding: 16px 20px;
  background: var(--panel-2);
  border: 2px dashed rgba(53, 88, 183, 0.4); /* 잉크펜 점선 테두리 느낌 */
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
}

.reddit-invite-banner:hover {
  transform: translateY(-4px);
  background: var(--highlight);
  border-style: solid;
  border-color: var(--focus);
  box-shadow: 0 12px 24px rgba(53, 88, 183, 0.15);
}

.invite-icon {
  font-size: 32px;
  animation: floatUp 3s ease-in-out infinite alternate;
}

.invite-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.invite-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--focus); /* 잉크 블루 색상 */
}

.invite-desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  line-height: 1.3;
}

.invite-desc strong {
  color: var(--danger);
  font-weight: 800;
}

.invite-arrow {
  font-size: 20px;
  color: var(--focus);
  opacity: 0.5;
  transition: transform 0.2s, opacity 0.2s;
}

.reddit-invite-banner:hover .invite-arrow {
  transform: translateX(4px);
  opacity: 1;
}