@import url('../_shared/arcade.css?v=20260607c');

:root {
  --accent: #e5a93b;
  --accent2: #8b5716;
  --gold: #ffe0a3;
  --hot: #ff3b4b;
  --relic-active: #00ffd5;
  --dark-bg: #1a0f05;
  --panel-bg: rgba(22, 13, 4, 0.94);
}

/* Base Lock overrides to prevent mobile page scrolling/zooming */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior-y: contain;
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.game-shell {
  background: radial-gradient(circle at 50% 6%, #3a220b 0%, #1e1105 45%, #0c0702 100%);
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Three.js Canvas playing area */
.game-wrap {
  flex: 1;
  display: block;
  background: #0c0702;
  position: relative;
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Floating 2D indicator text layer */
.floater-container {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

.floater-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 1000;
  font-size: 0.98rem;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.95), 0 0 4px var(--accent);
  pointer-events: none;
  white-space: nowrap;
  animation: float-rise 0.95s cubic-bezier(0.18, 0.89, 0.32, 1.25) forwards;
}

.floater-text.red-trap {
  color: var(--hot);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.95), 0 0 5px var(--hot);
}

.floater-text.green-relic {
  color: var(--relic-active);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.95), 0 0 5px var(--relic-active);
}

@keyframes float-rise {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(1.15); }
}

/* HUD System Overlay */
.hud {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
}

.hud-top {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  flex-wrap: wrap;
  width: 100%;
}

.turn-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(26, 15, 5, 0.76);
  border: 1px solid rgba(229, 169, 59, 0.35);
  backdrop-filter: blur(10px);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: #fff;
  box-shadow: 0 0 16px -4px var(--accent);
}

.turn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  flex-shrink: 0;
}

.turn-banner.cpu-turn {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.turn-banner.cpu-turn .turn-dot {
  background: #aaa;
  box-shadow: none;
  animation: thinkblink 0.8s ease-in-out infinite;
}

@keyframes thinkblink {
  50% { opacity: 0.25; }
}

/* Relics Display */
.relic-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(26, 15, 5, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.relic-hud-label {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
}

.relic-item {
  font-size: 1.15rem;
  opacity: 0.22;
  filter: grayscale(100%);
  transition: opacity 0.3s, filter 0.3s, transform 0.3s;
  display: inline-block;
  cursor: default;
}

.relic-item.active {
  opacity: 1;
  filter: none;
  transform: scale(1.15);
  text-shadow: 0 0 12px var(--relic-active);
}

/* Moves indicator */
.hud-moves-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 15, 5, 0.76);
  border: 1px solid rgba(229, 169, 59, 0.45);
  border-radius: 12px;
  padding: 4px 14px;
  backdrop-filter: blur(10px);
  line-height: 1;
  min-width: 65px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.hud-moves-chip span {
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 800;
  margin-bottom: 2px;
}

.hud-moves-chip b {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
}

/* Inventory panel for CPU */
.hud-inventory {
  position: absolute;
  top: 56px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cpu-relics-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(12, 7, 2, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 700;
}

.relic-dot-cpu {
  font-size: 0.72rem;
  filter: grayscale(100%);
  opacity: 0.22;
  transition: all 0.3s;
}

.relic-dot-cpu.active {
  filter: none;
  opacity: 1;
}

/* HUD controls dock at bottom */
.hud-controls-dock {
  margin: 0 auto;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  align-items: center;
  z-index: 25;
}

.action-dock-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  background: rgba(26, 15, 5, 0.88);
  border: 1.5px solid rgba(229, 169, 59, 0.35);
  border-radius: 20px;
  padding: 8px 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.dice-result {
  min-width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 1000;
  font-size: 1.4rem;
  color: #1a0f05;
  background: linear-gradient(160deg, #fff, #ffe9b0);
  border: 2px solid rgba(229, 169, 59, 0.8);
  box-shadow: 0 0 12px rgba(229, 169, 59, 0.4);
  transition: transform 0.25s cubic-bezier(0.2, 1.5, 0.3, 1.2);
}

.dice-result.rolling {
  animation: diceroll 0.15s linear infinite;
}

@keyframes diceroll {
  0% { transform: scale(0.9) rotate(0deg); }
  50% { transform: scale(1.1) rotate(180deg); }
  100% { transform: scale(0.9) rotate(360deg); }
}

.roll-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: #1a0f05;
  background: linear-gradient(135deg, #ffd24a, #e5a93b);
  box-shadow: 0 6px 20px rgba(229, 169, 59, 0.4);
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
  height: 44px;
}

.roll-btn:active {
  transform: translateY(1.5px);
}

.roll-btn:disabled {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}

.roll-btn.pulse {
  animation: buttonpulse 1.6s ease-in-out infinite;
}

@keyframes buttonpulse {
  50% { box-shadow: 0 6px 28px rgba(229, 169, 59, 0.8); }
}

.action-btn {
  height: 44px;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transition: all 0.2s;
  padding: 0 16px;
  cursor: pointer;
}

.action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.action-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.action-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

.select-rotate-btn.active-target {
  background: linear-gradient(135deg, rgba(229, 169, 59, 0.35), rgba(139, 87, 22, 0.35));
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(229, 169, 59, 0.4);
  animation: glowpulse 1.5s infinite alternate;
}

@keyframes glowpulse {
  from { box-shadow: 0 0 6px rgba(229, 169, 59, 0.2); }
  to { box-shadow: 0 0 16px rgba(229, 169, 59, 0.6); }
}

.control-help {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  background: rgba(12, 7, 2, 0.6);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Event banner */
.event-banner {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%) scale(0.7);
  z-index: 14;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  text-align: center;
  font-weight: 1000;
  font-size: clamp(1.2rem, 5.5vw, 2.2rem);
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 0 25px rgba(0, 0, 0, 0.9), 0 0 35px var(--accent);
}

.event-banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Onboarding Interactive Tutorial Overlay */
.tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(70px, 12vh, 110px) 20px 20px;
}

.tutorial-overlay.hidden {
  display: none !important;
}

.tutorial-panel {
  width: min(390px, 100%);
  background: var(--panel-bg);
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.tutorial-header span {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.skip-btn {
  background: transparent;
  border: none;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.skip-btn:hover {
  color: #fff;
}

.tutorial-panel p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

.tutorial-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}

#tutorial-step-indicator {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #120902;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.75rem;
}

.tutorial-pointer {
  position: absolute;
  z-index: 36;
  font-size: 1.8rem;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0,0,0,0.8);
  pointer-events: none;
  animation: arrow-bob 0.8s infinite alternate;
}

.tutorial-pointer.hidden {
  display: none !important;
}

@keyframes arrow-bob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

/* How to play tabs & subpanels */
.how-tabs {
  display: flex;
  gap: 5px;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.how-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.how-tab-btn.active {
  background: rgba(229, 169, 59, 0.15);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px rgba(229, 169, 59, 0.2);
}

.how-content-scroll {
  max-height: 48vh;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 12px;
}

.how-subpanel {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.how-subpanel.active {
  display: flex;
}

.rule-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
}

.rule-card b {
  font-size: 0.8rem;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.rule-card p {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}

.rule-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule-list li {
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--muted);
  padding-left: 6px;
  border-left: 2px solid var(--accent);
}

.rule-list li b {
  color: #fff;
  display: block;
}

.tile-grid-help {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tile-help-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 8px 12px;
}

.tile-help-item span {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-help-item b {
  font-size: 0.78rem;
  color: #fff;
  min-width: 95px;
}

.tile-help-item p {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.3;
}

/* Settings Configurations Screen */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0 20px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  gap: 12px;
}

.difficulty-cluster {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 2px;
}

.diff-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.diff-btn.active {
  background: var(--accent);
  color: #120902;
  box-shadow: 0 2px 6px rgba(229, 169, 59, 0.3);
}

.toggle-btn {
  width: 60px;
  height: 30px;
  border-radius: 15px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  font-family: inherit;
  font-weight: 900;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn.active {
  background: rgba(77, 214, 106, 0.18);
  border-color: #2ecc71;
  color: #2ecc71;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.2);
}

/* Credits styling */
.credits-body {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
  padding: 10px 0;
  text-align: center;
}

.credits-divider {
  border: none;
  border-top: 1.5px solid rgba(255, 255, 255, 0.06);
  margin: 10px 0;
}

.credits-body b {
  color: var(--gold);
}

/* Screen overlay additions */
.toast-out {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

@media (max-width: 560px) {
  .hud-top {
    justify-content: space-between;
  }
  .hud-moves-chip {
    padding: 3px 8px;
    min-width: 50px;
  }
  .hud-moves-chip b {
    font-size: 0.95rem;
  }
  .turn-banner {
    padding: 6px 12px;
    font-size: 0.72rem;
  }
  .relic-hud {
    padding: 4px 10px;
  }
  .relic-hud-label {
    display: none; /* Hide label on tiny phones to save row space */
  }
  .relic-item {
    font-size: 0.95rem;
  }
  .hud-inventory {
    top: 48px;
  }
  .action-dock-inner {
    padding: 6px 10px;
    gap: 8px;
    border-radius: 16px;
  }
  .dice-result {
    min-width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  .roll-btn {
    padding: 0 12px;
    font-size: 0.85rem;
    height: 44px;
    border-radius: 10px;
  }
  .action-btn {
    height: 44px;
    border-radius: 10px;
    font-size: 0.75rem;
    padding: 0 10px;
  }
}

@media (max-width: 380px) {
  .action-dock-inner {
    gap: 5px;
    padding-inline: 6px;
  }
  .roll-btn {
    padding-inline: 8px;
  }
  .action-btn {
    padding-inline: 7px;
    font-size: 0.68rem;
  }
  .control-help {
    max-width: calc(100vw - 24px);
    line-height: 1.25;
  }
}
