/* Gourmet Match Custom Flat Styles */

:root {
  --bg-color: #0b0f17;
  --card-bg: rgba(22, 30, 46, 0.95);
  --border-color: rgba(255, 255, 255, 0.05);
  --primary: #2b8880;
  --primary-border: #00f3ff;
  --text-color: #ffffff;
  --text-muted: #9ca3af;
  --gold: #ffb703;
  --success: #2a9d8f;
  --danger: #e63946;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* Aspect ratio 9:16 layout constraint overrides */
.game-wrapper {
  position: relative;
  width: 100vw;
  width: 100dvw;
  height: 177.78vw;
  height: 177.78dvw;
  max-width: 450px;
  max-height: 800px;
  background: #0b0f17;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3) !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  border: 2px solid var(--border-color);
  box-sizing: border-box;
  padding: 0 !important;
}

/* Ensure HUD is relative and fits exactly under the ad banner */
.hud-layer {
  position: relative !important;
  width: 100% !important;
  height: 45px !important;
  background: #1e293b !important;
  border-bottom: 2px solid var(--primary) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 0 12px !important;
  margin: 0 !important;
  z-index: 99 !important;
  box-sizing: border-box !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
}

/* Canvas container fills the rest of the height */
.canvas-container {
  position: relative;
  width: 100% !important;
  flex: 1 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden;
  background-color: #0b0f19;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
}

/* Menu Screens (Start & Map) */
.menu-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  text-align: center;
  z-index: 5;
}

.start-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  margin-bottom: 15px;
}

.start-title .highlight {
  color: var(--gold);
}

.start-description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 320px;
  margin-bottom: 30px;
}

.food-preview-bar {
  display: flex;
  gap: 12px;
  font-size: 28px;
  margin-bottom: 40px;
}

/* Map Screen Layout */
.map-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 40px;
}

.map-path {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 25px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0;
}

/* Connected map nodes path effect - grows dynamically with scroll height */
.map-path::before {
  content: '';
  position: absolute;
  top: 15px;
  bottom: 15px;
  width: 4px;
  background: var(--primary);
  opacity: 0.3;
  z-index: 1;
}

.map-node-container, .map-node-containerLocked {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: center;
  margin: 14px 0;
  flex-shrink: 0;
}

#node-container-1 { transform: translateX(-40px); }
#node-container-2 { transform: translateX(40px); }
#node-container-3 { transform: translateX(-40px); }
#node-container-4 { transform: translateX(40px); }
#node-container-5 { transform: translateX(-40px); }
#node-container-6 { transform: translateX(40px); }
#node-container-7 { transform: translateX(-40px); }
#node-container-8 { transform: translateX(40px); }
#node-container-9 { transform: translateX(-40px); }
#node-container-10 { transform: translateX(40px); }
#node-container-11 { transform: translateX(-40px); }
#node-container-12 { transform: translateX(40px); }
#node-container-13 { transform: translateX(-40px); }
#node-container-14 { transform: translateX(40px); }
#node-container-15 { transform: translateX(-40px); }
#node-container-16 { transform: translateX(40px); }
#node-container-17 { transform: translateX(-40px); }
#node-container-18 { transform: translateX(40px); }
#node-container-19 { transform: translateX(-40px); }
#node-container-20 { transform: translateX(40px); }
#node-container-21 { transform: translateX(-40px); }
#node-container-22 { transform: translateX(40px); }
#node-container-23 { transform: translateX(-40px); }
#node-container-24 { transform: translateX(40px); }
#node-container-25 { transform: translateX(-40px); }
#node-container-26 { transform: translateX(40px); }
#node-container-27 { transform: translateX(-40px); }
#node-container-28 { transform: translateX(40px); }
#node-container-29 { transform: translateX(-40px); }
#node-container-30 { transform: translateX(40px); }


.map-node {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2px solid var(--primary-border);
  color: var(--text-color);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: transform 0.2s, background-color 0.2s;
}

.map-node:hover:not(.locked) {
  transform: scale(1.1);
  background-color: #1a635d;
}

.map-node.locked {
  background-color: #1f2937;
  border-color: #374151;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.stars-container {
  position: absolute;
  bottom: -15px;
  display: flex;
  gap: 2px;
  font-size: 11px;
  color: var(--gold);
}

/* Flat Cyberpunk Pill Buttons */
.menu-btn {
  background: #2b8880 !important;
  border: 2px solid #00f3ff !important;
  color: #ffffff !important;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  border-radius: 30px !important;
  padding: 11px 16px !important;
  cursor: pointer;
  transition: all 0.2s ease !important;
  text-transform: uppercase;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
}

.menu-btn:hover {
  background: #00f3ff !important;
  color: #0b0f19 !important;
  transform: translateY(-1px);
}

.menu-btn:active {
  transform: translateY(0);
}

.secondary-btn {
  background-color: #1f2937 !important;
  border-color: #4b5563 !important;
}

.secondary-btn:hover {
  background-color: #4b5563 !important;
  color: #ffffff !important;
}

/* Active Gameplay Viewport */
#game-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  z-index: 5;
  justify-content: space-around;
}

.game-info-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  background-color: rgba(22, 28, 40, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 15px;
  margin-bottom: 10px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.info-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
}

#target-indicators-container {
  display: flex;
  gap: 8px;
}

.target-indicator {
  display: flex;
  align-items: center;
  gap: 2px;
  background-color: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

/* 8x8 Grid Board Container */
#grid-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 380px;
  background-color: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  padding: 4px;
  gap: 4px;
}

/* Grid Tile Styling */
.grid-tile {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s;
}

.grid-tile:hover {
  transform: scale(1.05);
}

.grid-tile.selected {
  outline: 2px solid #ffffff;
  z-index: 10;
  transform: scale(1.1);
}

/* Drop-down and swap transitions */
.grid-tile.swapping {
  transition: transform 0.2s ease-in-out;
}

.grid-tile.falling {
  animation: fallAnimation 0.3s ease-in;
}

.grid-tile.matched {
  animation: matchPop 0.25s forwards ease-out;
}

@keyframes fallAnimation {
  0% { transform: translateY(-50px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes matchPop {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); }
  100% { transform: scale(0); opacity: 0; }
}

/* Overlays & Modals */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
}

.overlay-card {
  width: 90%;
  max-width: 360px;
  background: #1e293b !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  padding: 24px 16px !important;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5) !important;
  animation: modalEnter 0.3s ease-out;
}

.start-card {
  border: 1px solid #3b82f6 !important;
}

.game-over-card {
  border: 1px solid #ef4444 !important;
}

.level-clear-card {
  border: 1px solid #10b981 !important;
  max-width: 320px;
}

@keyframes modalEnter {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.overlay-card h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.overlay-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 25px;
}

.overlay-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.overlay-buttons button {
  width: 100%;
}

/* Victory Stars styling */
.victory-stars {
  display: flex;
  gap: 8px;
  font-size: 36px;
  color: var(--gold);
  margin-bottom: 20px;
}

.star-victory.inactive {
  color: rgba(255,255,255,0.1);
}

/* Stats box for game-over/score displays */
.stats-box {
  width: 100%;
  background-color: rgba(0,0,0,0.3);
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-line:last-child {
  margin-bottom: 0;
}

.stat-line .highlight {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
}

/* Utility Hidden state */
.hidden {
  display: none !important;
}

/* Double Button Row Layout */
.button-row-double {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  margin-bottom: 5px;
}

/* Full Width Primary Play Button */
.main-start-btn {
  width: 100% !important;
  margin-top: 8px;
  margin-bottom: 8px;
  flex: none;
  font-size: 14px;
}

/* Pill Shaped Transparent Outline Return Button */
.home-link-pill {
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(0, 243, 255, 0.4) !important;
  color: #00f3ff !important;
  text-decoration: none;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1px;
  border-radius: 30px;
  padding: 10px 24px;
  transition: all 0.2s ease;
  margin-top: 15px;
  margin-bottom: 4px;
  display: inline-block;
  text-transform: uppercase;
  text-align: center;
  box-shadow: none !important;
}

.home-link-pill:hover {
  background: rgba(0, 243, 255, 0.1) !important;
  border-color: #00f3ff !important;
  color: #ffffff !important;
}

/* Ensure gameplay partner layer bottom is relative and constrained inside wrapper */
.partner-panel-layout-bottom {
  position: relative !important;
  width: 100% !important;
  height: 64px !important;
  background: #0f172a !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  z-index: 100 !important;
  bottom: 0 !important;
  left: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.partner-panel-layout-bottom.hidden {
  display: none !important;
}

.partner-holder-bottom {
  width: 320px !important;
  height: 50px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.menu-brand-header {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  margin-bottom: 15px;
  padding: 0 10px;
}

.brand-logo {
  height: 24px;
  filter: none !important;
  border: none;
}

.layout-divider {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

/* Custom Overlays for Status HUD inside Canvas Container */
.game-status-overlay {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  z-index: 10;
  text-shadow: none !important;
}

#status-level {
  color: var(--success) !important;
}

#status-moves {
  color: var(--gold) !important;
}

.cumulative-score-overlay {
  position: absolute;
  top: 44px;
  left: 15px;
  right: 15px;
  text-align: center;
  pointer-events: none;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.8px;
  z-index: 10;
  color: #ffffff;
  text-shadow: none !important;
}

/* Fix ad overlap under HUD */
.gameplay-ad-layer {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  background-color: #0b0f17 !important;
  width: 100% !important;
  height: 64px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 100 !important;
}

/* HUD Buttons styling */
.hud-reset-btn, .hud-volume-btn {
  background: none !important;
  border: none !important;
  color: #9ca3af !important;
  cursor: pointer !important;
  padding: 0 8px !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center;
}

.hud-reset-btn:hover, .hud-volume-btn:hover {
  transform: scale(1.1) !important;
  color: #ffffff !important;
}

.hud-reset-btn svg, .hud-volume-btn svg {
  width: 20px !important;
  height: 20px !important;
  stroke: currentColor !important;
  display: block !important;
}

/* 11. Obstacles & Special Tiles */

/* Jelly (Buz/Jöle Kaplama) */
.grid-tile.jelly {
  background-color: rgba(0, 243, 255, 0.15) !important;
  border: 1.5px solid rgba(0, 243, 255, 0.4) !important;
  box-shadow: inset 0 0 8px rgba(0, 243, 255, 0.6);
}

/* Stone Blocker (Kaya Engeli) */
.grid-tile.stone {
  background: radial-gradient(circle, #4b5563, #111827) !important;
  border: 2px solid #6b7280 !important;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9);
  cursor: not-allowed !important;
}

/* Striped Food (Match 4: Çizgili Özel Taş) */
.grid-tile.striped::after {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border: 2px dashed #00f3ff;
  border-radius: 6px;
  animation: rotateBorder 6s linear infinite;
  pointer-events: none;
}

/* Bomb Food (Match 5 T/L: Bombalı Özel Taş) */
.grid-tile.bomb::after {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border: 2.5px solid #ef4444;
  border-radius: 6px;
  box-shadow: 0 0 10px #ef4444, inset 0 0 4px #ef4444;
  animation: pulseBorder 1.5s infinite;
  pointer-events: none;
}

/* Rainbow Dessert (Match 5 Line: Renk Patlatıcı Özel Taş) */
.grid-tile.rainbow {
  background: radial-gradient(circle, rgba(244, 63, 94, 0.4), rgba(59, 130, 246, 0.4), rgba(16, 185, 129, 0.4)) !important;
  border: 2.5px solid #ffffff !important;
  box-shadow: 0 0 12px #ffffff, inset 0 0 8px #a855f7;
  animation: rainbowGlow 2s infinite alternate;
}

/* Animations */
@keyframes rotateBorder {
  100% { transform: rotate(360deg); }
}

@keyframes pulseBorder {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

@keyframes rainbowGlow {
  0% { box-shadow: 0 0 6px #e0f2fe; }
  100% { box-shadow: 0 0 18px #a855f7; }
}
