/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@font-face {
  font-family: 'PixelFont';
  src: local('Press Start 2P'), local('Courier New');
}

body {
  font-family: 'Courier New', monospace;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Game Container */
#game-container {
  width: 800px;
  height: 600px;
  background: #16213e;
  border: 4px solid #e94560;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(233, 69, 96, 0.3);
}

/* Screens */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Intro Screen */
#intro-screen {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  justify-content: center;
  align-items: center;
  text-align: center;
}

.intro-content {
  padding: 40px;
}

.intro-content h1 {
  font-size: 32px;
  color: #e94560;
  text-shadow: 2px 2px 0 #0f3460;
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.subtitle {
  font-size: 18px;
  color: #f9b208;
  margin-bottom: 30px;
}

.intro-text {
  max-width: 500px;
  margin: 0 auto 30px;
  line-height: 1.8;
}

.intro-text p {
  margin-bottom: 15px;
  color: #ccc;
}

/* Pixel Button */
.pixel-btn {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  padding: 15px 30px;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.2s;
  box-shadow: 0 4px 0 #a31545;
}

.pixel-btn:hover {
  background: #f9b208;
  box-shadow: 0 4px 0 #c98c06;
  transform: translateY(-2px);
}

.pixel-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #a31545;
}

/* Game Screen */
#game-screen {
  background: #0f3460;
}

/* Room Container */
#room-container {
  position: relative;
  width: 100%;
  height: 480px;
  background: #1a1a2e;
  overflow: hidden;
}

#room-background {
  width: 100%;
  height: 100%;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.3s ease;
}

#hotspots-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  cursor: pointer;
  pointer-events: auto;
}

/* Room Name */
#room-name {
  height: 30px;
  background: #0f3460;
  color: #f9b208;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 3px;
  border-top: 2px solid #e94560;
  border-bottom: 2px solid #e94560;
}

/* Message Area */
#message-area {
  height: 40px;
  background: #16213e;
  color: #ccc;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  text-align: center;
  min-height: 40px;
}

#message-area.highlight {
  color: #f9b208;
  animation: messageFlash 0.5s;
}

@keyframes messageFlash {
  0%, 100% { background: #16213e; }
  50% { background: #1a3a5c; }
}

/* Inventory Bar */
#inventory-bar {
  height: 50px;
  background: #0f3460;
  display: flex;
  align-items: center;
  padding: 0 15px;
  gap: 10px;
  border-top: 2px solid #e94560;
}

#inventory-label {
  color: #e94560;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#inventory-slots {
  display: flex;
  gap: 8px;
  flex: 1;
}

.inventory-slot {
  width: 40px;
  height: 40px;
  background: #16213e;
  border: 2px solid #1a3a5c;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 20px;
}

.inventory-slot:hover {
  border-color: #f9b208;
}

.inventory-slot.selected {
  border-color: #e94560;
  background: #1a3a5c;
  box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.inventory-slot img {
  max-width: 32px;
  max-height: 32px;
  image-rendering: pixelated;
}

#gift-counter {
  color: #f9b208;
  font-size: 14px;
  padding: 8px 15px;
  background: #16213e;
  border-radius: 4px;
  border: 2px solid #f9b208;
}

/* Dialog Overlay */
#dialog-overlay,
#puzzle-overlay,
#code-reveal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.hidden {
  display: none !important;
}

#dialog-box,
#puzzle-box {
  background: #16213e;
  border: 4px solid #e94560;
  border-radius: 8px;
  padding: 30px;
  max-width: 600px;
  max-height: 450px;
  overflow-y: auto;
  position: relative;
}

#dialog-box {
  min-width: 300px;
}

#puzzle-box {
  min-width: 500px;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: #e94560;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #f9b208;
}

#dialog-content {
  color: #ccc;
  line-height: 1.6;
}

#dialog-content h3 {
  color: #f9b208;
  margin-bottom: 15px;
}

#dialog-content p {
  margin-bottom: 10px;
}

#dialog-content .item-image {
  text-align: center;
  margin: 20px 0;
  font-size: 48px;
}

/* Puzzle Box */
#puzzle-title {
  color: #e94560;
  text-align: center;
  margin-bottom: 20px;
}

#puzzle-content {
  color: #ccc;
}

/* Puzzle-specific styles */
.puzzle-input {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.puzzle-input input {
  width: 50px;
  height: 50px;
  text-align: center;
  font-size: 24px;
  font-family: 'Courier New', monospace;
  background: #0f3460;
  border: 2px solid #e94560;
  border-radius: 4px;
  color: #fff;
}

.puzzle-input input:focus {
  outline: none;
  border-color: #f9b208;
}

.puzzle-submit {
  display: block;
  margin: 20px auto 0;
}

.puzzle-grid {
  display: grid;
  gap: 5px;
  margin: 20px auto;
  width: fit-content;
}

.puzzle-cell {
  width: 40px;
  height: 40px;
  background: #0f3460;
  border: 2px solid #1a3a5c;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.puzzle-cell:hover {
  border-color: #f9b208;
}

.puzzle-cell.selected {
  background: #e94560;
  border-color: #e94560;
}

.puzzle-cell.correct {
  background: #2ecc71;
  border-color: #27ae60;
}

.puzzle-cell.wrong {
  background: #e74c3c;
  border-color: #c0392b;
  animation: shake 0.3s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.puzzle-hint {
  text-align: center;
  color: #888;
  font-size: 12px;
  margin-top: 15px;
}

/* Code editor puzzle */
.code-editor {
  background: #1e1e1e;
  border: 2px solid #333;
  border-radius: 4px;
  padding: 15px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  margin: 15px 0;
}

.code-line {
  display: flex;
  gap: 10px;
  margin: 5px 0;
}

.code-line-number {
  color: #666;
  user-select: none;
  width: 25px;
}

.code-line-content {
  flex: 1;
}

.code-line-content input {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #9cdcfe;
  font-family: inherit;
  font-size: inherit;
  padding: 2px 5px;
  width: 100%;
}

.code-line-buggy {
  background: rgba(231, 76, 60, 0.15);
  border-left: 3px solid #e74c3c;
  margin-left: -3px;
}

.code-line-input {
  background: #2a2a2a;
  border: 1px solid #e74c3c;
  color: #9cdcfe;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  padding: 3px 6px;
  width: 100%;
  box-sizing: border-box;
}

.code-keyword { color: #569cd6; }
.code-string { color: #ce9178; }
.code-number { color: #b5cea8; }
.code-comment { color: #6a9955; }
.code-function { color: #dcdcaa; }
.code-variable { color: #9cdcfe; }

/* February calendar puzzle */
.feb-calendar {
  background: #0f3460;
  border: 2px solid #1a3a5c;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}

.cal-title {
  text-align: center;
  color: #f9b208;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-weekday {
  text-align: center;
  color: #888;
  font-size: 10px;
  padding: 4px 0;
}

.cal-day {
  background: #16213e;
  border: 1px solid #1a3a5c;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px 0;
  min-height: 34px;
}

.cal-day.empty {
  background: transparent;
  border: none;
}

.cal-day.marked {
  border-color: #f9b208;
  background: #1a3a5c;
}

.cal-num {
  font-size: 11px;
  color: #ccc;
}

.cal-mark {
  font-size: 10px;
  line-height: 1;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
  font-size: 10px;
  color: #888;
}

/* Book cipher puzzle */
.bookshelf {
  display: flex;
  gap: 3px;
  justify-content: center;
  align-items: flex-end;
  margin: 15px 0;
  padding: 10px 8px;
  background: #2a1a0a;
  border-radius: 4px;
}

.book {
  width: 28px;
  height: 80px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 1px;
  font-size: 10px;
  transition: transform 0.2s;
  position: relative;
}

.book-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 6px;
  letter-spacing: 0.5px;
  opacity: 0.9;
  overflow: hidden;
  flex: 1;
}

.book-num {
  font-size: 8px;
  opacity: 0.6;
}

.book:hover {
  transform: translateY(-5px);
}

.book.selected {
  transform: translateY(-10px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Simon Says cat puzzle */
.simon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 240px;
  margin: 15px auto;
}

.simon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #1a1a2e;
  cursor: pointer;
  transition: all 0.15s;
}

.simon-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.simon-btn:not(:disabled):hover {
  background: #2a2a4e;
}

.simon-emoji {
  font-size: 28px;
}

.simon-label {
  font-size: 10px;
  color: #888;
}

.simon-btn.simon-active {
  background: #f9b208;
  border-color: #f9b208;
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(249, 178, 8, 0.5);
}

.simon-btn.simon-press {
  background: #27ae60;
  border-color: #27ae60;
  transform: scale(0.95);
}

.simon-btn.simon-wrong {
  background: #e74c3c;
  border-color: #e74c3c;
  animation: simon-shake 0.3s;
}

@keyframes simon-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Cat puzzle */
.cat-scene {
  position: relative;
  width: 100%;
  height: 200px;
  background: #0f3460;
  border-radius: 4px;
  margin: 15px 0;
  overflow: hidden;
}

.cat-sprite {
  position: absolute;
  font-size: 40px;
  cursor: pointer;
  transition: all 0.5s ease-out;
}

.cat-item {
  position: absolute;
  font-size: 24px;
  cursor: pointer;
}

/* Window puzzle styles */
.window-hotspot {
  border-width: 1px !important;
}

.window-view-scene {
  width: 260px;
  height: 180px;
  margin: 10px auto;
  border: 3px solid #5a4a3a;
  border-radius: 2px;
  overflow: hidden;
}

.window-view-scene.blurred .window-scene-inner {
  filter: blur(8px);
  -webkit-filter: blur(8px);
}

.window-scene-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, #e8d5b7 0%, #dcc9a7 55%, #8b7355 55.5%, #7a6348 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.window-scene-table {
  width: 120px;
  height: 45px;
  background: linear-gradient(to bottom, #8b6f47, #654321);
  border-radius: 6px 6px 2px 2px;
  position: absolute;
  bottom: 28%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  box-shadow: 3px 10px 8px -4px rgba(0,0,0,0.3);
}

.window-scene-plate {
  width: 36px;
  height: 36px;
  background: radial-gradient(circle, #fff 55%, #eee 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  margin-top: -10px;
}

.window-food-emoji {
  font-size: 22px;
}

.window-food-emoji img.emoji {
  width: 22px;
  height: 22px;
}

/* Easter egg bedroom scene */
.window-scene-bedroom {
  background: linear-gradient(to bottom, #d4a0a0 0%, #c99393 55%, #8b7355 55.5%, #7a6348 100%) !important;
}

.ee-bed {
  position: absolute;
  bottom: 22%;
  width: 140px;
}

.ee-headboard {
  width: 140px;
  height: 30px;
  background: #5a3a2a;
  border-radius: 8px 8px 0 0;
  border: 2px solid #4a2a1a;
  border-bottom: none;
}

.ee-mattress {
  width: 140px;
  height: 40px;
  background: #fff;
  border-radius: 0 0 4px 4px;
  position: relative;
  overflow: visible;
}

.ee-blanket {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 30px;
  background: #e94560;
  border-radius: 0 0 4px 4px;
  animation: blanketBounce 0.6s ease-in-out infinite;
}

.ee-heads {
  display: flex;
  justify-content: center;
  gap: 2px;
  position: absolute;
  top: -8px;
  width: 100%;
  animation: headsBounce 0.6s ease-in-out infinite;
}

.ee-head {
  width: 16px;
  height: 16px;
  background: #3a3a3a;
  border-radius: 50%;
}

.ee-hearts {
  position: absolute;
  top: -40px;
  width: 100%;
  height: 40px;
}

.ee-heart {
  position: absolute;
  font-size: 12px;
  animation: heartFloat 1.5s ease-out infinite;
  opacity: 0;
}

@keyframes blanketBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes headsBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes heartFloat {
  0% { opacity: 0.8; transform: translateY(0) scale(0.8); }
  100% { opacity: 0; transform: translateY(-25px) scale(1.2); }
}

/* Dish selection grid */
.dish-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.dish-option {
  background: #0f3460;
  border: 2px solid #1a3a5c;
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.dish-option:hover {
  border-color: #f9b208;
  background: #12395a;
}

.dish-option.selected {
  border-color: #e94560;
  background: #1a3a5c;
  box-shadow: 0 0 8px rgba(233, 69, 96, 0.4);
}

.dish-option.wrong {
  animation: shake 0.3s;
}

.dish-emoji {
  display: block;
  font-size: 24px;
  margin-bottom: 2px;
}

.dish-emoji img.emoji {
  width: 24px;
  height: 24px;
}

.dish-name {
  font-size: 10px;
  color: #aaa;
  display: block;
}

/* Mountain route puzzle */
.mountain-map {
  position: relative;
  width: 100%;
  height: 250px;
  background: linear-gradient(to bottom, #87ceeb 0%, #228b22 50%, #654321 100%);
  border-radius: 4px;
  margin: 15px 0;
  overflow: hidden;
}

.map-point {
  position: absolute;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.map-point:hover {
  transform: scale(1.2);
}

.map-point.connected {
  filter: drop-shadow(0 0 5px #f9b208);
}

.route-line {
  position: absolute;
  height: 3px;
  background: #e94560;
  transform-origin: left center;
  pointer-events: none;
}

/* Code Reveal */
#code-reveal-box {
  background: linear-gradient(135deg, #16213e 0%, #1a3a5c 100%);
  border: 4px solid #f9b208;
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

#code-reveal-box h2 {
  color: #f9b208;
  font-size: 24px;
  margin-bottom: 15px;
}

#gift-name {
  color: #e94560;
  font-size: 18px;
  margin-bottom: 20px;
}

#code-image-container {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  margin: 20px auto;
  display: inline-block;
}

#code-image {
  max-width: 300px;
  max-height: 200px;
  image-rendering: auto;
}

.hint-text {
  color: #888;
  font-size: 12px;
  margin: 15px 0;
  font-style: italic;
}

.confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image:
    radial-gradient(circle, #e94560 2px, transparent 2px),
    radial-gradient(circle, #f9b208 2px, transparent 2px),
    radial-gradient(circle, #2ecc71 2px, transparent 2px);
  background-size: 50px 50px, 70px 70px, 60px 60px;
  background-position: 0 0, 25px 25px, 10px 40px;
  animation: confettiFall 2s linear infinite;
  opacity: 0.5;
}

@keyframes confettiFall {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* Gifts Screen */
#gifts-screen {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  padding: 30px;
  overflow-y: auto;
}

#gifts-screen h1 {
  color: #e94560;
  text-align: center;
  margin-bottom: 30px;
}

#gifts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.gift-card {
  background: #16213e;
  border: 2px solid #1a3a5c;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  transition: all 0.2s;
}

.gift-card.unlocked {
  border-color: #f9b208;
  cursor: pointer;
}

.gift-card.unlocked:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(249, 178, 8, 0.3);
}

.gift-card.locked {
  opacity: 0.5;
}

.gift-card .gift-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.gift-card .gift-title {
  font-size: 12px;
  color: #ccc;
}

.gift-card.locked .gift-icon::after {
  content: ' ';
  display: block;
  font-size: 24px;
}

#back-to-game {
  display: block;
  margin: 0 auto;
}

/* Board game pieces display */
.board-game-display {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 20px 0;
  flex-wrap: wrap;
}

.piece-group {
  text-align: center;
  background: #0f3460;
  padding: 15px;
  border-radius: 8px;
  min-width: 80px;
}

.piece-group .pieces {
  font-size: 24px;
  margin-bottom: 5px;
}

.piece-group .label {
  font-size: 12px;
  color: #888;
}

/* Twemoji styling */
img.emoji {
  height: 1em;
  width: 1em;
  margin: 0 .05em 0 .1em;
  vertical-align: -0.1em;
}

.gift-icon img.emoji {
  width: 48px;
  height: 48px;
}

.inventory-slot img.emoji {
  width: 24px;
  height: 24px;
}

.puzzle-cell img.emoji {
  width: 30px;
  height: 30px;
}

.item-image img.emoji {
  width: 48px;
  height: 48px;
}


/* Responsive */
@media (max-width: 820px) {
  #game-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    border-width: 0;
  }

  #room-container {
    height: calc(100vh - 120px);
  }
}
