:root {
  /* Cozy Palette */
  --bg: #eef2f6;
  --panel: #ffffff;
  --primary: #6366f1;
  /* Indigo */
  --primary-hover: #4f46e5;
  --accent: #f59e0b;
  /* Amber */
  --accent-light: #fcd34d;
  --text: #1e293b;
  --text-muted: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --glass: rgba(255, 255, 255, 0.7);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Z-Index Layers */
  --z-base: 1;
  --z-floating: 100;
  --z-overlay: 1000;
  --z-modal: 2000;
  --z-toast: 3000;
  --z-tooltip: 4000;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

h1,
h2,
h3,
h4,
label {
  font-weight: 700;
  color: var(--text);
}

h1 {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  margin: 0 0 1rem;
  color: var(--primary);
}

h2 {
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  margin: 0 0 0.5rem;
}

h3 {
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  margin: 0 0 1rem;
}

/* Accessibility: Focus States */
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: var(--z-floating);
}

.icon-btn:hover {
  opacity: 1;
}

/* Layout */
.game-container {
  max-width: 800px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  display: block;
  padding: 20px;
  height: 100vh;
}

.game-stage {
  background: var(--panel);
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  letter-spacing: 0.5px;
  padding: clamp(12px, 3vw, 13px);
  border-radius: clamp(8px, 2vw, 16px);
  overflow-y: auto;
  max-height: calc(100vh - 40px);
  box-shadow: var(--shadow-sm);
}

#event-text {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  line-height: 1.6;
  margin-bottom: clamp(12px, 2vh, 24px);
}

/* Choices */
.choice-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-container button {
  background: var(--panel);
  border: 2px solid #e2e8f0;
  /* Fallback */
  border: 2px solid var(--bg);
  /* Better contrast if bg is distinct */
  border-color: #e2e8f0;
  border-radius: clamp(8px, 1.5vw, 12px);
  padding: clamp(8px, 2vw, 12px) clamp(12px, 2.5vw, 16px);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.choice-container button:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.choice-container button:active {
  transform: translateY(0);
}

/* Controls */
.controls {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 12px;
}

.controls button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'Nunito', sans-serif;
}

.controls button:hover {
  background: var(--primary-hover);
}

#boss {
  background: var(--danger);
}

#boss:hover {
  background: var(--danger-hover);
}

.status-bar {
  background: #e2e8f0;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  margin-bottom: 10px;
}

.status-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #34d399);
  width: 50%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 6px;
}

.hp-text {
  font-size: 0.9rem;
  font-weight: 600;
  float: right;
  margin-top: -40px;
  /* Kept for layout structure, but risky */
  color: var(--text-muted);
  text-transform: uppercase;
  position: relative;
  /* Ensure z-index works if needed */
  z-index: var(--z-base);
}

.pd-hp {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 8px;
  display: block;
  justify-items: center;
}

/* Inventory */
.game-inventory {
  margin-top: 16px;
  padding: 12px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
}

.game-inventory h3 {
  margin: 0 0 8px 0;
  font-size: 1rem;
}

.game-inventory .inventory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.game-inventory .inventory-list li {
  background: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
}

.game-inventory .inventory-list li::before {
  content: '•';
  color: var(--primary);
  margin-right: 6px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--panel);
  padding: clamp(16px, 4vw, 32px);
  border-radius: clamp(12px, 3vw, 24px);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal:not(.hidden) .modal-content {
  transform: translateY(0);
}

#modal-ascii {
  background: #fef3c7;
  color: #92400e;
  margin-bottom: 16px;
}

#modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

#modal-actions button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

#modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-status {
  font-weight: 700;
  margin-top: 12px;
}

.goose-hp-section {
  position: relative;
  display: flex;
  justify-content: center;
  background: #ff4646;
  color: white;
  padding: 8px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 1rem;
}

.goose-hp-text {
  font-weight: 700;
  font-size: medium;
  color: white;
  margin-left: 8px;
  text-transform: uppercase;
}

/* Toasts */
.toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: var(--z-toast);
}

.toast {
  background: white;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  animation: slide-up 0.3s ease-out;
  border-left: 4px solid var(--primary);
}

.toast.info {
  border-color: var(--primary);
}

.toast.warn {
  border-color: var(--accent);
}

.toast.success {
  border-color: var(--success);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tutorial Spotlight */
.tutorial-spotlight {
  position: relative;
  z-index: var(--z-overlay) !important;
  box-shadow: 0 0 0 4px var(--accent), 0 0 0 1000px rgba(0, 0, 0, 0.5);
  background: var(--panel);
  transition: box-shadow 0.3s ease;
  pointer-events: none;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
  transition: opacity 0.5s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  text-align: center;
  background: var(--panel);
  padding: 40px;
  border-radius: 32px;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
  animation: float 6s ease-in-out infinite;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-bottom: 32px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.primary-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 50px;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.logo-bounce {
  animation: bounce 2s infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
  }
}

.pulse {
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}

/* Visual Juice */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px) rotate(-1deg);
  }

  75% {
    transform: translateX(5px) rotate(1deg);
  }
}

.shake {
  animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

.floating-text {
  position: fixed;
  pointer-events: none;
  font-weight: 800;
  font-size: 1.5rem;
  animation: float-up 1s ease-out forwards;
  z-index: var(--z-toast);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@keyframes float-up {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-40px) scale(1.2);
  }
}

/* UX "Alarm" Feedback */
.critical-state::after {
  content: '';
  position: fixed;
  inset: 0;
  box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.5);
  pointer-events: none;
  z-index: var(--z-overlay);
  animation: pulse-critical 2s infinite;
}

@keyframes pulse-critical {

  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.8;
  }
}

.heal-effect::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(16, 185, 129, 0.2);
  pointer-events: none;
  z-index: var(--z-overlay);
  animation: flash-heal 0.5s ease-out forwards;
}

@keyframes flash-heal {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* Responsive - Tablet and below */
@media (max-width: 900px) {
  .game-container {
    padding: 16px;
  }

  .icon-btn {
    top: 10px;
    right: 10px;
    font-size: 1.3rem;
  }
}

/* Responsive - Mobile */
@media (max-width: 600px) {
  .game-container {
    padding: 8px;
  }

  .game-stage {
    padding: 16px;
    border-radius: 12px;
  }

  h1 {
    font-size: 1.2rem;
  }

  .choice-container {
    gap: 8px;
  }

  .choice-container button {
    font-size: 0.85rem;
    padding: 10px 14px;
  }

  .controls {
    flex-direction: column;
    gap: 8px;
  }

  .controls button {
    width: 100%;
    padding: 12px;
  }

  .toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    font-size: 0.85rem;
    padding: 10px 16px;
  }

  .footer {
    font-size: 11px;
    left: 8px;
    bottom: 8px;
  }
}

/* Victory Screen Enhancements */
.victory-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.85);
}

/* Sunburst Background */
.sunburst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 200vmax;
  background: repeating-conic-gradient(from 0deg,
      rgba(255, 255, 255, 0.03) 0deg,
      rgba(255, 255, 255, 0.03) 15deg,
      transparent 15deg,
      transparent 30deg);
  transform: translate(-50%, -50%);
  animation: rotate-sunburst 60s linear infinite;
  z-index: 0;
  pointer-events: none;
}

.victory-badge {
  position: relative;
  width: 320px;
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px;
  z-index: 1;
  animation: pop-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.5));
}

/* Blue Banner Background */
.badge-banner {
  position: absolute;
  top: 50px;
  width: 200px;
  height: 320px;
  background: linear-gradient(to bottom, #1e40af, #1e3a8a);
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
  clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
  border: 4px solid #fbbf24;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
  z-index: 0;
}

.badge-banner::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
  clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
}

/* Hexagonal Frame */
.hex-outer {
  width: 240px;
  height: 260px;
  background: linear-gradient(135deg, #f59e0b, #fcd34d, #b45309);
  -webkit-clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.hex-inner {
  width: 216px;
  height: 236px;
  background: #ffffff;
  -webkit-clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Inner glow for hex */
.hex-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.1), transparent 60%);
  pointer-events: none;
}

.winner-duck {
  width: 236px;
  height: 236px;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
  z-index: 2;
}

/* Ribbon Container */
.victory-ribbon {
  position: absolute;
  bottom: 13px;
  width: 380px;
  height: 80px;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Main Ribbon Body */
.ribbon-content {
  position: relative;
  background: linear-gradient(to bottom, #fcd34d, #f59e0b, #b45309);
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%);
  clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

/* Ribbon Folds (Pseudo-3D effect) */
.victory-ribbon::before,
.victory-ribbon::after {
  content: '';
  position: absolute;
  top: 20px;
  width: 40px;
  height: 60px;
  background: #92400e;
  z-index: 1;
}

.victory-ribbon::before {
  left: 10px;
  transform: skewY(15deg);
}

.victory-ribbon::after {
  right: 10px;
  transform: skewY(-15deg);
}

.victory-title {
  font-family: 'Nunito', sans-serif;
  font-size: 2.8rem;
  font-weight: 900;
  color: #78350f;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.victory-message {
  font-size: 1.5rem;
  color: #e2e8f0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  margin-bottom: 32px;
  z-index: 2;
  font-weight: 700;
  text-align: center;
  max-width: 80%;
}

.footer {
  color: #333;
  font-size: 13px;
  opacity: .8;
  margin-top: 13px;
}

@keyframes rotate-sunburst {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes pop-in {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Compact Layout for Iframe/Short Screens */
@media (max-height: 500px) {
  body {
    padding: 0;
    overflow: hidden;
  }

  .game-container {
    margin: 10px auto;
    gap: 16px;
    height: calc(100vh - 20px);
    overflow: hidden;
  }

  .game-stage {
    padding: 16px;
    margin-bottom: 0;
    overflow-y: auto;
  }

  h1 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }

  .character-art {
    height: 100px;
    width: auto;
  }

  #event-text {
    font-size: 1rem;
    margin-bottom: 12px;
    margin-top: -10px;

  }

  .choice-container button {
    padding: 0px 12px;
    font-size: 0.9rem;
  }

  .controls {
    padding-top: 12px;
  }

  .controls button {
    padding: 8px 16px;
  }

  .hp-text {
    margin-top: -38px;
    font-size: 0.8rem;
  }

  .footer {
    display: none;
  }
}

/* Utility */
.hidden {
  display: none !important;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.3s;
}

.boss-content {
  border-radius: clamp(8px, 2vw, 12px);
  padding: clamp(12px, 3vw, 20px);
  background-color: var(--panel);
  width: 100%;
  max-width: 600px;
  margin: auto;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: calc(100vh - 40px);
}

.character-art-large {
  width: clamp(120px, 30vw, 150px);
  margin: 0 auto;
  display: block;
}

.character-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: clamp(8px, 2vh, 16px) 0;
}

.char-visual {
  flex: 0 0 auto;
}

.char-stats {
  flex: 1;
  max-width: 300px;
}

.character-art {
  max-width: 100%;
  height: auto;
  width: clamp(120px, 25vw, 140px);
  display: block;
}

/* Responsive adjustment for character section */
@media (max-width: 600px) {
  .character-container {
    flex-direction: column;
    text-align: center;
  }

  .char-stats {
    width: 100%;
    max-width: 100%;
  }
}

.button {
  padding: 8px 16px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .sunburst,
  .logo-bounce,
  .pulse,
  .overlay-content {
    animation: none;
  }
}

/* Help Button */
.help-btn {
  border-color: black;
  color: white;
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
  opacity: 0.9;
}

.help-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

/* Keyboard Controls Overlay */
.keyboard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  transition: opacity 0.3s;
}

.keyboard-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.keyboard-content {
  background: var(--panel);
  padding: 40px;
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.4s ease-out;
}

.keyboard-content h2 {
  margin-top: 0;
  color: var(--primary);
  text-align: center;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text);
}

.keyboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.key-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-md);
}

.key-visual {
  width: 60px;
  height: 60px;
  background: white;
  border: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary);
  box-shadow: 0 4px 0 var(--primary-hover);
}

.key-label {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.keyboard-tip {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 16px 0 0 0;
}

/* Tutorial Overlay */
.tutorial-content {
  background: var(--panel);
  padding: 48px;
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 90%;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.5s ease-out;
}

.skip-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: 2px solid var(--text-muted);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.skip-btn:hover {
  background: var(--text-muted);
  color: white;
}

.tutorial-progress {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: all 0.3s;
}

.progress-dot.active {
  background: var(--primary);
  transform: scale(1.3);
}

.tutorial-step {
  text-align: center;
}

.tutorial-step h2 {
  color: var(--primary);
  margin-bottom: 16px;
}

.tutorial-step p {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 24px;
  color: var(--text);
}

.tutorial-highlight {
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--text);
}

.tutorial-next-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 16px;
}

.tutorial-next-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* End Screen Stats */
.end-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
  z-index: 2;
}

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  color: #e2e8f0;
  margin: 0;
  backdrop-filter: blur(4px);
}

.stat-item strong {
  color: var(--accent-light);
  font-size: 1.3rem;
}

/* Responsive for new elements */
@media (max-width: 600px) {
  .keyboard-content {
    padding: 24px;
  }

  .keyboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tutorial-content {
    padding: 32px 24px;
  }

  .key-visual {
    width: 50px;
    height: 50px;
    font-size: 1rem;
  }

  .end-stats {
    width: 90%;
    margin: 16px auto;
  }

  .stat-item {
    font-size: 1rem;
    padding: 10px 16px;
  }
}


.tutorial-next-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 16px;
}

.tutorial-next-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* End Screen Stats */
.end-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
  z-index: 2;
}

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  color: #e2e8f0;
  margin: 0;
  backdrop-filter: blur(4px);
}

.stat-item strong {
  color: var(--accent-light);
  font-size: 1.3rem;
}

/* Responsive for new elements */
@media (max-width: 600px) {
  .keyboard-content {
    padding: 24px;
  }

  .keyboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tutorial-content {
    padding: 32px 24px;
  }

  .key-visual {
    width: 50px;
    height: 50px;
    font-size: 1rem;
  }

  .end-stats {
    width: 90%;
    margin: 16px auto;
  }

  .stat-item {
    font-size: 1rem;
    padding: 10px 16px;
  }
}

/* Loading Screen Styles */
.loading-duck {
  animation: duck-bounce 1s ease-in-out infinite;
}

@keyframes duck-bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.loading-bar {
  width: 100%;
  max-width: 300px;
  height: 8px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  margin: 20px auto;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Game Over State Overrides */
.state-gameover .victory-container {
  background: rgba(15, 23, 42, 0.95);
}

.state-gameover .sunburst {
  display: none;
  /* No sunburst for losers */
}

.state-gameover .badge-banner {
  background: linear-gradient(to bottom, #334155, #1e293b);
  border-color: #94a3b8;
}

.state-gameover .hex-outer {
  background: linear-gradient(135deg, #64748b, #475569, #334155);
}

.state-gameover .ribbon-content {
  background: linear-gradient(to bottom, #94a3b8, #64748b, #475569);
}

.state-gameover .victory-ribbon::before,
.state-gameover .victory-ribbon::after {
  background: #334155;
}

.state-gameover .victory-title {
  color: #1e293b;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.state-gameover #restart-btn {
  background: transparent;
  border: 2px solid #94a3b8;
  color: #e2e8f0;
  box-shadow: none;
}

.state-gameover #restart-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
  color: white;
  transform: translateY(-2px);
}

/* Victory State Specifics (Reinforce defaults) */
.state-victory .victory-container {
  background: rgba(15, 23, 42, 0.85);
}

.state-victory #restart-btn {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.state-victory #restart-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}