/* Fraction Pizza Chef Stylesheet */
:root {
  --bg-primary: #191630;
  --bg-secondary: #272147;
  --bg-card: #352d5f;
  --panel-bg: #ffffff;
  --ink-dark: #241c42;
  --ink-muted: #6a638f;
  --accent-gold: #ffbe26;
  --accent-orange: #ff7826;
  --accent-red: #e63946;
  --accent-green: #2ec4b6;
  --pizza-crust: #c97f32;
  --pizza-cheese: #ffd152;
  --pizza-sauce: #d63031;
  --pizza-topping: #a31d1d;
  --font-family: "Fredoka", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: radial-gradient(circle at top center, #2e2659 0%, #131024 100%);
  color: #ffffff;
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease;
}

/* Background Celebration Pulse */
body.flash-correct {
  animation: flashPizzeria 0.7s ease-out;
}
@keyframes flashPizzeria {
  0% { background-color: #2ec4b6; }
  50% { background-color: #ff9326; }
  100% { background-color: transparent; }
}

/* Top Nav Bar */
.top-nav-bar {
  background: rgba(19, 16, 36, 0.95);
  border-bottom: 2px solid #3d3570;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.home-link {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s;
}
.home-link:hover {
  transform: translateX(-3px);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-links a {
  color: #bcb6ea;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}
.nav-links a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.active-badge {
  background: linear-gradient(135deg, #ff7826, #ffbe26);
  color: #131024;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(255, 190, 38, 0.4);
}

/* Main Layout Shell */
.app-shell {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.chef-avatar {
  font-size: 2.8rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
  animation: chefBounce 3s ease-in-out infinite alternate;
}
@keyframes chefBounce {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-5px) rotate(4deg); }
}

.brand h1 {
  font-size: 2.1rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 3px 0 #1b1638;
}
.brand .tagline {
  color: #bcb6ea;
  font-size: 1rem;
  font-weight: 500;
}

.stats-group {
  display: flex;
  gap: 12px;
}

.stat-badge {
  background: #2a2354;
  border: 2px solid #4a3e87;
  border-radius: 14px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 0 #15112e;
}
.stat-badge .icon {
  font-size: 1.4rem;
}
.stat-badge .label {
  font-size: 0.85rem;
  color: #aaa4db;
  font-weight: 600;
  text-transform: uppercase;
}
.stat-badge strong {
  font-size: 1.3rem;
  color: var(--accent-gold);
  font-weight: 700;
}

/* Customer Order Card */
.order-card {
  background: linear-gradient(135deg, #372b69, #251c4a);
  border: 3px solid #ffbe26;
  border-radius: 22px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 16px rgba(255, 190, 38, 0.15);
  flex-wrap: wrap;
}

.customer-avatar-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}
.customer-avatar {
  font-size: 3.2rem;
  background: #46377e;
  border: 3px solid #6b57b5;
  border-radius: 50%;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.customer-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffbe26;
}

.order-details {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.order-bubble {
  background: #ffffff;
  border: 2px solid #ded8ff;
  border-radius: 18px;
  padding: 12px 18px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-dark);
  max-width: 380px;
  box-shadow: 0 4px 0 #cfc7f5;
  line-height: 1.4;
}
.order-bubble strong {
  color: #e63946;
  font-size: 1.15rem;
}

/* Fraction Badge */
.fraction-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid #5a4b9c;
  border-radius: 16px;
  padding: 8px 16px;
}

.fraction-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
}
.frac-num {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent-gold);
  line-height: 1;
}
.frac-bar {
  width: 100%;
  height: 3px;
  background: #ffffff;
  border-radius: 2px;
  margin: 3px 0;
}
.frac-den {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent-green);
  line-height: 1;
}

.fraction-words {
  display: flex;
  flex-direction: column;
}
.word-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: #ffffff;
}
.word-desc {
  font-size: 0.8rem;
  color: #b5aee6;
}

/* Settings Panel */
.settings-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.setting {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c9c3f7;
  font-weight: 600;
  font-size: 0.9rem;
}
.setting select {
  background: #2a2354;
  border: 2px solid #50448f;
  border-radius: 12px;
  padding: 8px 14px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.setting select:focus {
  border-color: var(--accent-gold);
}

.rank-indicator {
  background: #2a2354;
  border: 2px solid #50448f;
  border-radius: 12px;
  padding: 5px 12px;
  gap: 8px;
}
.rank-badge {
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 0.9rem;
}

.streak-dots {
  display: inline-flex;
  gap: 5px;
}
.streak-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #403673;
  border: 1.5px solid #5c4e9f;
  transition: all 0.25s;
}
.streak-dot.active {
  background: #ffb400;
  border-color: #ff9f1c;
  box-shadow: 0 0 8px #ffbe26;
  transform: scale(1.2);
}

.level-reset-btn {
  border: 0;
  background: #43387a;
  color: #dedaff;
  cursor: pointer;
  font: 600 0.8rem var(--font-family);
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.level-reset-btn:hover {
  background: #5a4b9e;
  color: #fff;
}

/* Kitchen Board */
.kitchen-board {
  background: #ffffff;
  border-radius: 28px;
  padding: 28px 24px;
  color: var(--ink-dark);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35), 0 0 0 6px #413578;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.kitchen-instruction {
  font-size: 1.15rem;
  font-weight: 600;
  color: #4b3e82;
  text-align: center;
}
.kitchen-instruction strong {
  color: #e63946;
  font-size: 1.25rem;
}

/* Interactive Pizza Slicing Stage */
.interactive-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.pizza-cutting-board {
  background: radial-gradient(circle, #f7f1e6 60%, #e8d9c2 100%);
  border: 6px solid #b38550;
  border-radius: 50%;
  padding: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), inset 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pizza-svg {
  width: 250px;
  height: 250px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

/* SVG Slice styling */
.pizza-slice {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  transform-origin: 120px 120px;
}
.pizza-slice:hover {
  filter: brightness(1.08);
  transform: scale(1.03);
}

.slice-base {
  fill: #ffe8b3;
  stroke: #c78738;
  stroke-width: 3px;
  transition: fill 0.2s ease;
}
.slice-crust {
  fill: #c78738;
  stroke: #9e6420;
  stroke-width: 2px;
}

/* When slice is selected (topped!) */
.pizza-slice.selected .slice-base {
  fill: #ffbe26;
  filter: drop-shadow(0 0 6px rgba(255, 120, 38, 0.6));
}

.slice-topping {
  display: none;
  pointer-events: none;
}
.pizza-slice.selected .slice-topping {
  display: block;
}

/* Buttons */
.interactive-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.serve-btn {
  background: linear-gradient(135deg, #ff7826, #ffbe26);
  border: 3px solid #b8500f;
  color: #1a1005;
  font-family: var(--font-family);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 8px 0 #8f3b05;
  transition: all 0.1s;
}
.serve-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 0 #8f3b05;
}
.serve-btn:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #8f3b05;
}

.clear-btn {
  background: #f0ecfc;
  border: 2px solid #c9c0f0;
  color: #554a8a;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b3a7e6;
  transition: all 0.1s;
}
.clear-btn:hover {
  background: #e4ddfa;
  transform: translateY(-1px);
}
.clear-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b3a7e6;
}

/* Matching Stage Cards */
.match-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pizza-options-grid {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pizza-choice-card {
  background: #fcfbfa;
  border: 3px solid #3b357a;
  border-radius: 20px;
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 0 #231e4e;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
  min-width: 140px;
}
.pizza-choice-card:hover {
  background: #fff8eb;
  transform: translateY(-3px);
  box-shadow: 0 11px 0 #231e4e;
}
.pizza-choice-card:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #231e4e;
}

.pizza-choice-card svg {
  width: 120px;
  height: 120px;
}
.pizza-choice-label {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2b2361;
}

/* Feedback text */
.feedback {
  font-size: 1.15rem;
  font-weight: 600;
  color: #554891;
  min-height: 32px;
  text-align: center;
  transition: all 0.2s;
}
.feedback.success {
  color: #0b9e76;
  font-weight: 700;
  transform: scale(1.05);
}
.feedback.try-again {
  color: #d6335e;
}

/* Footer controls */
.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-tip {
  font-size: 0.9rem;
  color: #a49dda;
}
.footer-actions {
  display: flex;
  gap: 12px;
}
.footer-btn {
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 12px;
  border: 2px solid #574b9e;
  background: #2a2354;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 0 #15112e;
  transition: all 0.15s;
}
.footer-btn:hover {
  background: #382f70;
  transform: translateY(-1px);
}
.footer-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #15112e;
}
.footer-btn.hint-btn {
  border-color: #ffaa00;
  color: var(--accent-gold);
}

/* Celebration particles & fireworks */
.celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.celebration.playing {
  animation: celebrationPulse 1.2s ease-out;
}
@keyframes celebrationPulse {
  0% { box-shadow: inset 0 0 80px rgba(255, 190, 38, 0.6); }
  100% { box-shadow: inset 0 0 0 rgba(255, 190, 38, 0); }
}

.confetti {
  position: absolute;
  top: -20px;
  left: var(--left);
  width: var(--size);
  height: calc(var(--size) * 1.4);
  background: var(--color);
  opacity: 0.95;
  transform: rotate(var(--tilt));
  animation: confettiFall 1.8s ease-out forwards;
  animation-delay: var(--delay);
  border-radius: 3px;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) translateX(var(--drift)) rotate(720deg); opacity: 0; }
}

.firework {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color);
  animation: fireworkPop 0.9s ease-out forwards;
  animation-delay: var(--delay);
}
@keyframes fireworkPop {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 var(--color); }
  50% { opacity: 0.9; }
  100% {
    transform: scale(22);
    opacity: 0;
    box-shadow: 0 0 30px var(--color), 0 0 60px #fff;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .app-shell { padding: 16px 12px 40px; }
  .brand h1 { font-size: 1.6rem; }
  .chef-avatar { font-size: 2.2rem; }
  .order-card { flex-direction: column; align-items: flex-start; }
  .order-details { flex-direction: column; align-items: flex-start; }
  .pizza-svg { width: 210px; height: 210px; }
  .pizza-choice-card { min-width: 100px; padding: 10px; }
  .pizza-choice-card svg { width: 90px; height: 90px; }
  .settings-panel { flex-direction: column; align-items: stretch; }
  .setting { justify-content: space-between; }
  .game-footer { flex-direction: column; text-align: center; }
}
