/* Ordsveis Native Arcade Styling */
:root {
  --bg-gradient: radial-gradient(circle at 50% 30%, #032b30 0%, #01161a 60%, #000a0d 100%);
  --accent-gold: #fbbf24;
  --accent-emerald: #10b981;
  --tile-gradient: linear-gradient(145deg, #fbbf24 0%, #f59e0b 60%, #d97706 100%);
  --tile-border-bottom: #92400e;
  --tile-border-top: #fde68a;
  --board-border: rgba(45, 212, 191, 0.5);
  --board-glow: rgba(45, 212, 191, 0.25);
}

.ordsveis-native-container {
  width: 100%;
  max-width: 1040px;
  min-height: 640px;
  height: clamp(540px, 80vh, 720px);
  border: 2px solid var(--border-light, #e8dcc4);
  border-radius: 24px;
  box-shadow: var(--shadow-lg, 0 20px 45px rgba(0,0,0,0.25));
  background: var(--bg-gradient);
  overflow: hidden;
  position: relative;
  touch-action: manipulation;
  overscroll-behavior: contain;
  margin: 0 auto 2rem auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

#particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
}

.ambient-glow {
  position: absolute;
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, var(--board-glow) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 0;
  animation: pulseGlow 4s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  from { transform: scale(0.85); opacity: 0.5; }
  to { transform: scale(1.3); opacity: 1; }
}

#app-wrapper {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  position: relative;
  z-index: 1;
  overflow: hidden;
  touch-action: manipulation;
}

.shake-impact {
  animation: screenShake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenShake {
  10%, 90% { transform: translate3d(-3px, 1px, 0) rotate(-1deg); }
  20%, 80% { transform: translate3d(4px, -2px, 0) rotate(1.5deg); }
  30%, 50%, 70% { transform: translate3d(-5px, 4px, 0) rotate(-1.5deg); }
  40%, 60% { transform: translate3d(5px, -2px, 0) rotate(1deg); }
}

/* Mobile Layout */
.mobile-layout {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
}

@media (max-width: 767px) {
  .ordsveis-native-container {
    min-height: unset !important;
    height: auto !important;
    max-width: calc(100% - 16px) !important;
    margin: 0.5rem auto 1.5rem auto !important;
    border-radius: 20px !important;
    padding: 8px 4px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
  }

  #app-wrapper {
    height: auto !important;
    min-height: unset !important;
    padding: 8px 6px !important;
  }

  .mobile-layout {
    height: auto !important;
    max-height: unset !important;
    justify-content: flex-start !important;
  }

  .top-header-mobile {
    margin-bottom: 8px !important;
  }

  .board-frame {
    width: 100% !important;
    max-width: 350px !important;
    aspect-ratio: 1 / 1 !important;
    margin-bottom: 8px !important;
    padding: 6px !important;
    gap: 4px !important;
  }

  .cell {
    border-radius: 8px !important;
  }

  .tile {
    border-radius: 8px !important;
    border-bottom-width: 3px !important;
    font-size: clamp(1rem, 4.2vw, 1.35rem) !important;
  }

  .powerups-row {
    gap: 6px !important;
    margin-bottom: 6px !important;
  }

  .powerup-circle {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.2rem !important;
  }

  .powerup-title {
    font-size: 0.75rem !important;
    margin-top: 3px !important;
  }

  .powerup-price {
    font-size: 0.72rem !important;
  }

  .words-container {
    height: 36px !important;
    padding: 2px 0 !important;
  }
}

.pc-layout {
  display: none;
}

.top-header-mobile {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.next-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
}

.next-label {
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 800;
}

.next-tile {
  width: 38px;
  height: 38px;
  background: var(--tile-gradient);
  border-bottom: 4px solid var(--tile-border-bottom);
  border-top: 1px solid var(--tile-border-top);
  border-radius: 10px;
  color: #ffffff;
  font-family: 'Rowdies', 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

.score-badge {
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid var(--accent-gold);
  border-radius: 16px;
  padding: 6px 20px;
  color: var(--accent-gold);
  font-family: 'Rowdies', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.25);
}

.action-icons {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 8px 10px;
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  transition: transform 0.12s ease, background 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  transform: scale(1.12);
  background: rgba(45, 212, 191, 0.25);
  border-color: var(--accent-emerald);
}

.board-frame {
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid var(--board-border);
  border-radius: 26px;
  padding: 8px;
  backdrop-filter: blur(18px);
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.65), 0 0 35px var(--board-glow);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.col-highlight {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16.66%;
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.35) 0%, rgba(16, 185, 129, 0.08) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.col-target {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16.66%;
  cursor: pointer;
  z-index: 20;
  touch-action: manipulation;
}

.cell {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.35);
  pointer-events: none;
  box-sizing: border-box;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.tile {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: var(--tile-gradient);
  border-bottom: 4px solid var(--tile-border-bottom);
  border-top: 1.5px solid var(--tile-border-top);
  border-left: 1px solid var(--tile-border-top);
  border-right: 1px solid var(--tile-border-bottom);
  color: #ffffff;
  font-family: 'Outfit', 'Rowdies', sans-serif;
  font-weight: 900;
  font-size: clamp(1.1rem, 3.8vw, 1.5rem);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  position: relative;
  z-index: 3;
  box-sizing: border-box;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tile.dropping {
  animation: dropTile 0.38s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes dropTile {
  0% { transform: translateY(-320px) scaleY(1.25); opacity: 0.8; }
  75% { transform: translateY(4px) scaleY(0.82); opacity: 1; }
  100% { transform: translateY(0) scaleY(1); opacity: 1; }
}

.tile.sveiset {
  background: linear-gradient(145deg, #10b981 0%, #059669 100%) !important;
  border-bottom-color: #047857 !important;
  border-top-color: #a7f3d0 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5) !important;
}

.tile.just-sveiset {
  animation: sveisPulseOnce 0.6s ease-out 1 !important;
}

@keyframes sveisPulseOnce {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.18); filter: brightness(1.4); }
  100% { transform: scale(1); }
}

/* Circular Power-Up Icons */
.powerups-row {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
}

.powerup-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.powerup-item:hover {
  transform: translateY(-4px) scale(1.06);
}

.powerup-item:active {
  transform: translateY(2px) scale(0.95);
}

.powerup-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  position: relative;
  transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.powerup-item:hover .powerup-circle {
  filter: brightness(1.25);
}

.powerup-circle.undo-circle {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  border: 2px solid #fdba74;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.45);
}

.powerup-circle.joker-circle {
  background: linear-gradient(135deg, #9333ea 0%, #6b21a8 100%);
  border: 2px solid #e9d5ff;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.45);
}

.powerup-circle.bomb-circle {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border: 2px solid #fca5a5;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.45);
}

.powerup-circle.hint-circle {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 2px solid #7dd3fc;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.45);
}

.powerup-title {
  color: #f1f5f9;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  margin-top: 5px;
}

.powerup-price {
  color: var(--accent-gold);
  font-family: 'Rowdies', sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  margin-top: 1px;
}

.words-container {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

.word-pill {
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 12px;
  padding: 6px 14px;
  color: #34d399;
  font-weight: 900;
  font-size: 0.9rem;
  white-space: nowrap;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.floating-popup {
  position: absolute;
  color: var(--accent-gold);
  font-family: 'Rowdies', sans-serif;
  font-weight: 900;
  font-size: 2.1rem;
  text-shadow: 0 4px 20px rgba(0,0,0,0.9), 0 0 35px rgba(251, 191, 36, 0.95);
  pointer-events: none;
  z-index: 100;
  animation: floatBanner 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes floatBanner {
  0% { transform: translateY(30px) scale(0.3) rotate(-8deg); opacity: 0; }
  25% { transform: translateY(-20px) scale(1.3) rotate(3deg); opacity: 1; }
  75% { transform: translateY(-60px) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-90px) scale(0.8); opacity: 0; }
}

/* Game Over Modal */
.game-over-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 22, 26, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.game-over-modal.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content {
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid var(--accent-gold);
  border-radius: 24px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 0 40px rgba(251, 191, 36, 0.3);
  max-width: 340px;
  width: 90%;
}

.modal-title {
  color: var(--accent-gold);
  font-family: 'Rowdies', sans-serif;
  font-size: 2rem;
  margin: 0 0 16px 0;
}

.modal-score-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
}

.modal-score-label {
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 700;
}

.modal-score-val {
  color: #ffffff;
  font-family: 'Rowdies', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
}

.modal-stats {
  color: #e2e8f0;
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.modal-btn {
  background: linear-gradient(145deg, #10b981, #059669);
  border: none;
  border-bottom: 4px solid #047857;
  border-radius: 16px;
  color: white;
  font-family: 'Rowdies', sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  padding: 14px 28px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
  transition: transform 0.12s ease;
}

.modal-btn:hover {
  transform: scale(1.04);
}

/* PC Widescreen Layout (min-width >= 768px) */
@media (min-width: 768px) {
  .mobile-layout {
    display: none;
  }

  .pc-layout {
    display: grid;
    grid-template-columns: 240px 1fr 240px;
    gap: 20px;
    width: 100%;
    max-width: 1060px;
    height: 100%;
    max-height: 660px;
    align-items: center;
  }

  .pc-panel {
    background: rgba(15, 23, 42, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  }

  .pc-panel-title {
    color: var(--accent-gold);
    font-family: 'Rowdies', sans-serif;
    font-size: 1.15rem;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .pc-board-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .pc-top-bar {
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }

  .pc-board-frame {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1 / 1;
    margin-bottom: 0;
  }

  .pc-powerups-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
    justify-items: center;
    align-items: center;
    padding: 8px 0;
  }

  .words-container-pc {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
  }
}
