/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #FFF8F0;
  color: #2D2D2D;
  font-size: 16px;
  line-height: 1.5;
}

/* === APP SHELL === */
#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* === SCREENS === */
.screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; }
.screen-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 16px;
}

/* === BUTTONS === */
.btn {
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  min-width: 48px;
}
.btn:active { transform: scale(0.96); opacity: 0.9; }
.btn-primary {
  background: #E8635A;
  color: white;
  width: 100%;
  max-width: 300px;
}
.btn-secondary {
  background: #4ECDC4;
  color: white;
  width: 100%;
  max-width: 300px;
}
.btn-hint {
  background: #A8B8D0;
  color: white;
  flex: 1;
}
.btn-submit {
  background: #4ECDC4;
  color: white;
  flex: 2;
}
.btn-reroll {
  background: transparent;
  color: #999;
  font-size: 12px;
  font-weight: 400;
  padding: 4px;
  text-decoration: underline;
  width: 100%;
  min-height: 32px;
}

/* === START SCREEN === */
#screen-start { overflow: hidden; }
.start-hero { font-size: 64px; margin-bottom: 8px; }
#screen-start > .start-content { position: relative; z-index: 2; }
.start-content h1 { font-size: 24px; color: #E8635A; text-shadow: 0 2px 12px rgba(255,255,255,0.9); line-height: 1.0; }
.title-name { font-size: 38px; display: block; margin-bottom: -10px; }
.subtitle { color: #777; font-size: 15px; text-shadow: 0 1px 6px rgba(255,255,255,0.8); }

.scout-portrait-img {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #E8635A;
  box-shadow: 0 4px 24px rgba(232, 99, 90, 0.35);
}

/* --- Party background decorations --- */
.party-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

/* Ribbons - curving colored streamers hanging from top */
.ribbon {
  position: absolute;
  top: -10px;
  width: 20px;
  border-radius: 0 0 50% 50%;
  opacity: 0.6;
  animation: ribbon-sway 3s ease-in-out infinite;
}
/* Top ribbons */
.ribbon-1 { left: 6%; height: 140px; background: linear-gradient(180deg, #FF6B8A, #FF6B8A44); animation-delay: 0s; width: 18px; }
.ribbon-2 { left: 25%; height: 110px; background: linear-gradient(180deg, #FFD166, #FFD16644); animation-delay: 0.6s; width: 20px; }
.ribbon-3 { left: 48%; height: 130px; background: linear-gradient(180deg, #5BC0BE, #5BC0BE44); animation-delay: 1.2s; width: 16px; }
.ribbon-4 { left: 70%; height: 100px; background: linear-gradient(180deg, #C576F6, #C576F644); animation-delay: 0.3s; width: 22px; }
.ribbon-5 { left: 88%; height: 120px; background: linear-gradient(180deg, #FF6B8A, #FF6B8A44); animation-delay: 0.9s; width: 16px; }
/* Bottom ribbons (grow upward from bottom) */
.ribbon-b1 { top: auto; bottom: -10px; left: 12%; height: 120px; background: linear-gradient(0deg, #C576F6, #C576F644); animation-delay: 0.4s; width: 16px; border-radius: 50% 50% 0 0; }
.ribbon-b2 { top: auto; bottom: -10px; left: 55%; height: 100px; background: linear-gradient(0deg, #FFD166, #FFD16644); animation-delay: 1s; width: 18px; border-radius: 50% 50% 0 0; }
.ribbon-b3 { top: auto; bottom: -10px; left: 82%; height: 90px; background: linear-gradient(0deg, #5BC0BE, #5BC0BE44); animation-delay: 0.7s; width: 14px; border-radius: 50% 50% 0 0; }

@keyframes ribbon-sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

/* Scattered party items — chaotic, organic feel */
.p {
  position: absolute;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}
/* TOP — stagger heights, don't line up */
/*  🎁 gift    */ .p1  { top: 0%;  left: 22%;  font-size: 56px; animation: pBob 3.2s ease-in-out infinite 0.1s; }
/*  🎈 balloon */ .p2  { top: 6%;  right: 3%;  font-size: 54px; animation: pBob 4.1s ease-in-out infinite 1.7s; }
/*  🎂 cake    */ .p3  { top: 3%;  left: 1%;   font-size: 34px; animation: pBob 3.9s ease-in-out infinite 0.4s; }
/*  ✨ sparkle */ .p4  { top: 16%; left: 42%;  font-size: 16px; animation: pSpin 4.2s linear infinite 2.3s; opacity: 0.75; }
/*  🎊 confet  */ .p5  { top: 16%; right: 38%; font-size: 22px; animation: pSpin 3.4s linear infinite 0.8s; opacity: 0.7; }
/*  🎉 popper  */ .p6  { top: 14%; left: 6%;   font-size: 40px; animation: pBob 3.6s ease-in-out infinite 1.3s; }
/*  🎈 balloon */ .p7  { top: 4%;  left: 48%;  font-size: 42px; animation: pBob 4.4s ease-in-out infinite 0.2s; }
/* MIDDLE — edges only, stagger inward amounts */
/*  🎀 ribbon  */ .p8  { top: 26%; left: 1%;   font-size: 20px; animation: pBob 3.8s ease-in-out infinite 2.5s; }
/*  🎁 gift    */ .p9  { top: 34%; right: 2%;  font-size: 32px; animation: pBob 4.0s ease-in-out infinite 0.6s; }
/*  🥳 face    */ .p10 { top: 56%; left: 2%;   font-size: 30px; animation: pBob 3.5s ease-in-out infinite 1.9s; }
/*  ✨ sparkle */ .p11 { top: 22%; right: 6%;  font-size: 14px; animation: pSpin 5.1s linear infinite 0.5s; opacity: 0.6; }
/*  🎂 cake    */ .p12 { top: 58%; right: 4%;  font-size: 38px; animation: pBob 3.3s ease-in-out infinite 1.1s; }
/*  🎈 balloon */ .p13 { top: 40%; left: 0%;   font-size: 52px; animation: pBob 4.3s ease-in-out infinite 0.3s; }
/*  🎊 confet  */ .p14 { bottom: 18%; left: 46%; font-size: 20px; animation: pSpin 3.7s linear infinite 2.0s; opacity: 0.7; }
/*  🎉 popper  */ .p15 { top: 50%; right: 0%;  font-size: 42px; animation: pBob 3.1s ease-in-out infinite 0.9s; }
/* BOTTOM — spread out, no overlaps */
/*  🎁 gift    */ .p16 { bottom: 14%; left: 2%;   font-size: 56px; animation: pBob 4.5s ease-in-out infinite 1.6s; }
/*  🎀 ribbon  */ .p17 { bottom: 16%; right: 16%; font-size: 28px; animation: pBob 3.8s ease-in-out infinite 2.2s; }
/*  🎂 cake    */ .p18 { bottom: 1%;  right: 18%; font-size: 36px; animation: pBob 4.2s ease-in-out infinite 0.7s; }
/*  🎈 balloon */ .p19 { bottom: 6%;  left: 30%;  font-size: 50px; animation: pBob 3.4s ease-in-out infinite 1.4s; }
/*  🎊 confet  */ .p20 { bottom: 1%;  left: 18%;  font-size: 24px; animation: pSpin 3.6s linear infinite 0.1s; opacity: 0.8; }
/*  🎉 popper  */ .p21 { bottom: 10%; right: 4%;  font-size: 34px; animation: pBob 4.0s ease-in-out infinite 2.7s; }
/*  ✨ sparkle */ .p22 { bottom: 12%; left: 22%;  font-size: 15px; animation: pSpin 4.8s linear infinite 1.2s; opacity: 0.65; }
/*  🎁 gift    */ .p23 { bottom: 2%;  left: 4%;   font-size: 30px; animation: pBob 3.7s ease-in-out infinite 0.5s; }
/*  🥳 face    */ .p24 { bottom: 1%;  left: 52%;  font-size: 44px; animation: pBob 4.6s ease-in-out infinite 1.8s; }

@keyframes pBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-12px) rotate(4deg); }
  66% { transform: translateY(-3px) rotate(-3deg); }
}
@keyframes pSpin {
  0% { transform: rotate(0deg) scale(1); opacity: 0.6; }
  50% { transform: rotate(180deg) scale(1.25); opacity: 1; }
  100% { transform: rotate(360deg) scale(1); opacity: 0.6; }
}

/* Breathing glow on Let's Go button */
#screen-start .btn-primary {
  animation: btnBreathe 2.5s ease-in-out infinite;
}
@keyframes btnBreathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 99, 90, 0.4); }
  50% { box-shadow: 0 0 20px 8px rgba(232, 99, 90, 0.35); }
}

/* === IDENTITY === */
.big-question { font-size: 24px; font-weight: 700; margin: 24px 0; }
.identity-buttons { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }

/* === INTRO === */
.intro-hero { font-size: 80px; }
#intro-text { color: #555; max-width: 340px; }

/* === PUZZLE SCREEN === */
.puzzle-header {
  padding: 8px 16px 6px;
  background: white;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.progress-bar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #E8635A, #FFD166);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}
.progress-text {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
  text-align: center;
}
.location-bar {
  padding: 12px 16px;
  background: linear-gradient(135deg, #5B3A8C, #E8635A);
  flex-shrink: 0;
  color: white;
  border-radius: 0 0 12px 12px;
}
.has-bg-image .location-bar {
  backdrop-filter: blur(6px);
  background: rgba(0,0,0,0.35) !important;
}
.location-name { font-weight: 700; font-size: 24px; }
.location-story { font-size: 16px; color: rgba(255,255,255,0.95); margin-top: 3px; line-height: 1.3; font-style: italic; }

.puzzle-area {
  flex: 1;
  padding: 10px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* Puzzle body wrapper */
.puzzle-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* When a background image is set — frosted overlay on middle section only */
.has-bg-image .puzzle-body {
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(3px);
}

.action-bar {
  padding: 8px 16px;
  background: white;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.action-row {
  display: flex;
  gap: 8px;
}

/* === HINT & FEEDBACK === */
.hint-box, .feedback-box {
  padding: 0 16px;
  text-align: center;
  font-size: 14px;
  overflow: hidden;
  transition: max-height 0.3s, padding 0.3s, opacity 0.3s;
  max-height: 0;
  opacity: 0;
  flex-shrink: 0;
}
.hint-box.visible, .feedback-box.visible {
  max-height: 120px;
  opacity: 1;
  padding: 6px 16px;
}
.hint-box {
  background: #FFF3CD;
  color: #664D03;
  font-size: 15px;
  font-weight: 500;
  border: 2px solid #FFD166;
  border-radius: 12px;
  margin: 4px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.hint-close {
  font-size: 11px;
  color: #999;
  margin-top: 6px;
  cursor: pointer;
}
.feedback-box {
  color: white;
  font-weight: 600;
}
.feedback-box.correct { background: #4CAF50; }
.feedback-box.incorrect { background: #E8635A; }
.feedback-box.partial { background: #FF9800; }

/* === SCOUT HINT (guest mode) === */
.scout-hint-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
}
.scout-avatar {
  font-size: 28px;
  flex-shrink: 0;
}
.scout-hint-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* === TRANSITION === */
.transition-check { font-size: 64px; }
.transition-text { font-size: 18px; color: #555; max-width: 300px; }

/* === FINALE === */
.finale-hero { font-size: 56px; }
.finale-content h1 { font-size: 26px; color: #E8635A; }
.stats-box {
  background: white;
  border-radius: 12px;
  padding: 16px;
  width: 100%;
  max-width: 300px;
  text-align: left;
  font-size: 14px;
  line-height: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stats-box div { display: flex; justify-content: space-between; }

/* ==============================
   PUZZLE-SPECIFIC STYLES
   ============================== */

/* --- SCRAMBLE --- */
.scramble-letters {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.scramble-tile {
  width: 48px; height: 48px;
  background: #E8635A;
  color: white;
  font-size: 22px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.puzzle-input {
  border: 2px solid #ddd;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 20px;
  text-align: center;
  width: 100%;
  max-width: 280px;
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: 600;
  outline: none;
}
.puzzle-input:focus { border-color: #4ECDC4; }
.puzzle-input[dir="rtl"] {
  letter-spacing: 0;
  font-size: 24px;
}

/* --- WORDLE --- */
.wordle-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
}
.wordle-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.wordle-cell {
  width: 36px; height: 36px;
  border: 2px solid #ddd;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  transition: background 0.3s, border-color 0.3s, color 0.3s;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.wordle-cell.correct { background: #6AAA64; color: white; border-color: #6AAA64; }
.wordle-cell.present { background: #C9B458; color: white; border-color: #C9B458; }
.wordle-cell.absent { background: #787C7E; color: white; border-color: #787C7E; }
.wordle-cell.filled { border-color: #999; }

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 360px;
}
.keyboard-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.key {
  min-width: 26px;
  height: 34px;
  border: none;
  border-radius: 4px;
  background: #E8E8EC;
  color: #2D2D2D;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  padding: 0 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.key.wide { min-width: 48px; font-size: 12px; font-weight: 700; }
.key.correct { background: #6AAA64; color: white; }
.key.present { background: #C9B458; color: white; }
.key.absent { background: #787C7E; color: white; }

.wordle-guide {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 11px;
  color: #888;
}
.wordle-guide span { display: flex; align-items: center; gap: 4px; }
.guide-box {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 3px;
}
.guide-box.correct { background: #6AAA64; }
.guide-box.present { background: #C9B458; }
.guide-box.absent { background: #787C7E; }

.wordle-submit-btn {
  background: #4ECDC4;
  color: white;
  width: 100%;
  max-width: 360px;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  padding: 8px;
  border-radius: 10px;
}

/* --- EMOJI DECIPHER --- */
.emoji-display {
  font-size: 42px;
  margin: 12px 0;
  letter-spacing: 8px;
}
.emoji-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}
.emoji-option {
  padding: 14px 16px;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: white;
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.emoji-option.selected { border-color: #4ECDC4; background: #E8FAF8; }
.emoji-option.correct-reveal { border-color: #4CAF50; background: #E8F5E9; }
.emoji-option.wrong-reveal { border-color: #E8635A; background: #FFEBEE; }

/* --- CONNECTIONS --- */
.connections-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 360px;
  margin-bottom: 8px;
}
.conn-tile {
  padding: 10px 4px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  word-break: break-word;
}
.conn-tile.selected { border-color: #4ECDC4; background: #E8FAF8; }
.conn-tile.solved { cursor: default; color: white; border-color: transparent; }

.solved-groups {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.solved-group {
  padding: 10px;
  border-radius: 8px;
  color: white;
  text-align: center;
  font-weight: 600;
}
.solved-group .group-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.9; }
.solved-group .group-items { font-size: 14px; margin-top: 2px; }

.conn-colors-0 { background: #6AAA64; }
.conn-colors-1 { background: #C9B458; }
.conn-colors-2 { background: #6A9FD6; }
.conn-colors-3 { background: #B07CD8; }

/* --- MENU DEDUCTION --- */
.menu-rules {
  background: #FFF8E1;
  border-radius: 10px;
  padding: 12px;
  width: 100%;
  max-width: 340px;
  margin-bottom: 12px;
  text-align: left;
  font-size: 14px;
}
.menu-rules li { margin: 4px 0; margin-left: 16px; }
.menu-pick-count { font-weight: 700; color: #1a1a1a; margin: 4px 0; font-size: 15px; }
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 340px;
}
.menu-item {
  padding: 10px 8px;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  transition: all 0.2s;
}
.menu-item.selected { border-color: #4ECDC4; background: #E8FAF8; }

/* --- ODD ONE OUT --- */
.odd-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 320px;
}
.odd-item {
  padding: 12px 8px;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  text-align: center;
  font-size: 28px;
  transition: all 0.2s;
}
.odd-item .odd-label { font-size: 13px; margin-top: 4px; }
.odd-item.selected { border-color: #E8635A; background: #FFEBEE; }

/* --- SEQUENCE --- */
.sequence-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}
.seq-slot {
  display: flex;
  align-items: center;
  gap: 8px;
}
.seq-num {
  width: 28px; height: 28px;
  background: #E8635A;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.seq-item {
  flex: 1;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.seq-item.selected { border-color: #4ECDC4; background: #E8FAF8; }
.seq-item.locked { background: #E8F5E9; border-color: #4CAF50; cursor: default; opacity: 0.7; }

/* --- MEMORY MATCH --- */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 320px;
}
.memory-card {
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  transition: transform 0.3s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.memory-card.face-down {
  background: linear-gradient(135deg, #E8635A, #FFD166);
  color: transparent;
}
.memory-card.face-down::after {
  content: '?';
  color: white;
  font-size: 24px;
}
.memory-card.face-up {
  background: white;
  border: 2px solid #4ECDC4;
}
.memory-card.matched {
  background: #E8F5E9;
  border: 2px solid #4CAF50;
  cursor: default;
}

/* --- CIPHER --- */
.cipher-encoded {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  letter-spacing: 2px;
  background: rgba(255,255,255,0.9);
  color: #2D2D2D;
  padding: 12px;
  border-radius: 8px;
  margin: 8px 0;
  word-break: break-all;
  text-align: center;
  width: 100%;
  max-width: 340px;
}
.cipher-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  width: 100%;
  max-width: 340px;
}
.cipher-char {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
}
.cipher-char.space { width: 16px; }
.cipher-line {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.cipher-top {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  color: #333;
  font-weight: 700;
  height: 24px;
}
.cipher-bottom {
  width: 28px;
  height: 28px;
  border: none;
  border-bottom: 2px solid #999;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #2D2D2D;
  background: rgba(255,255,255,0.9);
  text-transform: uppercase;
  outline: none;
  border-radius: 2px 2px 0 0;
}
.cipher-bottom.given {
  color: #4CAF50;
  border-bottom-color: #4CAF50;
}
.cipher-bottom:focus { border-bottom-color: #4ECDC4; }

/* --- PATTERN --- */
.pattern-sequence {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.pattern-item {
  font-size: 32px;
  min-width: 48px;
  text-align: center;
}
.pattern-blank {
  width: 48px;
  height: 48px;
  border: 3px dashed #E8635A;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.pattern-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 280px;
}
.pattern-choice {
  padding: 14px;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: white;
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.pattern-choice.selected { border-color: #4ECDC4; background: #E8FAF8; }

/* --- LOGIC GRID --- */
.logic-clues {
  background: #FFF8E1;
  border-radius: 10px;
  padding: 12px;
  width: 100%;
  max-width: 340px;
  margin-bottom: 12px;
  text-align: left;
  font-size: 13px;
}
.logic-clues li { margin: 6px 0; margin-left: 16px; }
.logic-matches {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
}
.logic-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logic-person {
  font-weight: 600;
  font-size: 14px;
  min-width: 80px;
}
.logic-select {
  flex: 1;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
}
.logic-select:focus { border-color: #4ECDC4; }

/* --- LETTER BANK --- */
.letter-hex {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 12px 0;
  max-width: 240px;
}
.hex-letter {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.hex-letter.center {
  background: #E8635A;
  color: white;
}
.hex-letter.outer {
  background: #eee;
  color: #2D2D2D;
}
.hex-letter:active { transform: scale(0.9); }
.lb-current-word {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 3px;
  min-height: 36px;
  text-transform: uppercase;
}
.lb-controls {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.lb-btn {
  padding: 8px 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  cursor: pointer;
}
.found-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
  max-width: 340px;
}
.found-word {
  background: #E8F5E9;
  color: #2E7D32;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
}
.lb-progress {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

/* === PUZZLE TITLE === */
.puzzle-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  text-align: center;
  color: #1a1a1a;
}

/* === ANIMATIONS === */
@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.screen.active { animation: pop 0.25s ease-out; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shake { animation: shake 0.3s ease; }

/* === LOADING SCREEN === */
#screen-loading .screen-content {
  gap: 16px;
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #eee;
  border-top-color: #E8635A;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  font-size: 18px;
  color: #888;
  font-weight: 600;
}

/* === WORDLE GUIDE CONTRAST === */
.has-bg-image .wordle-guide {
  background: rgba(255,255,255,0.85);
  border-radius: 8px;
  padding: 4px 8px;
}

/* === MENU MAX REACHED === */
.menu-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.menu-max-msg {
  font-size: 13px;
  color: #1a1a1a;
  font-weight: 700;
  margin-top: 4px;
}

/* === WORDLE FAIL POPUP === */
.wordle-fail-popup {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}
.wordle-fail-card {
  background: white;
  border-radius: 16px;
  padding: 24px 28px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 280px;
  width: 90%;
}
.wordle-fail-card p {
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin-bottom: 14px;
}
.wordle-fail-card .btn {
  margin: 4px;
  padding: 10px 20px;
  font-size: 14px;
}

/* === CONFETTI === */
.confetti-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 10;
}
.confetti-dot {
  position: absolute;
  top: -10px;
  border-radius: 50%;
  opacity: 0.85;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0.9; }
  20% { opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* === BIRTHDAY MUTE BUTTON === */
.bday-mute-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  -webkit-tap-highlight-color: transparent;
}
