:root {
  --panel-gold: #f5c451;
  --ink: #2a1a3d;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #120a1f;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

#game-root {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 720px;
  transform-origin: top left;
  background: #120a1f url("assets/background/background.jpg") center center / cover no-repeat;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
}

.hidden {
  display: none !important;
}

#particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.home-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 60;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(20, 10, 35, 0.65);
  border: 2px solid var(--panel-gold);
  color: #f0e6ff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

.home-btn:hover {
  filter: brightness(1.15);
}

/* ---------- Loading ---------- */

#screen-loading {
  justify-content: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 40%, #2c1c46 0%, #120a1f 75%);
}

.loading-emblem {
  font-size: 72px;
  animation: spin-glow 2.2s linear infinite;
}

.loading-text {
  color: #f0e6ff;
  font-size: 24px;
  font-weight: 600;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.loading-bar {
  width: 260px;
  height: 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.25);
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f5c451, #ff9d4d);
  transition: width 0.2s ease-out;
}

@keyframes spin-glow {
  0% { transform: rotate(0deg) scale(1); filter: drop-shadow(0 0 6px #f5c451); }
  50% { transform: rotate(180deg) scale(1.15); filter: drop-shadow(0 0 16px #f5c451); }
  100% { transform: rotate(360deg) scale(1); filter: drop-shadow(0 0 6px #f5c451); }
}

/* ---------- Start ---------- */

#screen-start {
  justify-content: flex-start;
  gap: 8px;
  padding-top: max(18px, env(safe-area-inset-top));
}

.game-title {
  margin: 0;
  text-align: center;
  color: #fff6e0;
  font-size: 27px;
  line-height: 1.15;
  font-weight: 800;
  text-shadow: 0 3px 0 rgba(0,0,0,0.35), 0 6px 18px rgba(0,0,0,0.4);
}

.start-row {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 48px;
}

.start-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.start-col--right {
  gap: 14px;
}

.wizard-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wizard-img {
  width: 230px;
  height: auto;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,0.45));
}

.speech-bubble {
  margin-top: -6px;
  background: rgba(255,255,255,0.95);
  color: var(--ink);
  font-weight: 700;
  font-size: 19px;
  padding: 9px 16px;
  border-radius: 18px;
  border: 3px solid var(--panel-gold);
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
  max-width: 300px;
  text-align: center;
}

.target-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(20, 10, 35, 0.55);
  border: 2px solid rgba(245, 196, 81, 0.6);
  border-radius: 20px;
  padding: 10px 16px;
}

.target-hint-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.target-arrow {
  color: var(--panel-gold);
  font-size: 26px;
  font-weight: 800;
}

.instruction-text {
  margin: 4px 0 0;
  color: #f0e6ff;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.art-button {
  margin: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease-out;
}

.art-button img {
  width: 230px;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.4));
}

.art-button:active {
  transform: scale(0.94);
}

/* ---------- Playing ---------- */

#screen-playing {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.playing-hud {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(15, 8, 26, 0.5);
  border: 2px solid rgba(245, 196, 81, 0.35);
  border-radius: 31px;
  padding: 19px 22px 17px;
  backdrop-filter: blur(1px);
}

.target-hint--playing {
  padding: 10px 17px;
}

.target-hint--playing .target-hint-icon {
  width: 53px;
  height: 53px;
}

.wizard-wrap--playing {
  margin-top: -2px;
}

.wizard-img--small {
  width: 168px;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.5));
}

.progress-row {
  display: flex;
  gap: 19px;
}

.progress-slot {
  width: 82px;
  height: 82px;
  border-radius: 19px;
  background: rgba(255,255,255,0.08);
  border: 3px solid rgba(245, 196, 81, 0.55);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.progress-slot img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.progress-slot.filled {
  background: rgba(245, 196, 81, 0.18);
  border-color: #f5c451;
  box-shadow: 0 0 18px rgba(245, 196, 81, 0.65);
  transform: scale(1.08);
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 18px;
  width: 100%;
  max-width: 620px;
}

.symbol-btn {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  border: 4px solid rgba(245, 196, 81, 0.55);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.16), rgba(40, 22, 66, 0.55));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
  transition: transform 0.08s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out;
}

.symbol-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35));
}

.symbol-btn:active {
  transform: scale(0.94);
}

.symbol-btn.correct {
  border-color: #ffe08a;
  box-shadow: 0 0 26px rgba(255, 224, 138, 0.85);
  animation: symbol-pulse 0.3s ease-out;
}

.symbol-btn.wrong {
  animation: symbol-wobble 0.45s ease-in-out;
}

@keyframes symbol-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

@keyframes symbol-wobble {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(7deg); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(3deg); }
}

/* ---------- Victory ---------- */

#screen-victory {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 50px;
  background: radial-gradient(circle at 50% 45%, rgba(120, 70, 190, 0.35), rgba(0,0,0,0) 60%);
}

.victory-left {
  position: relative;
  flex: 0 0 auto;
  width: 300px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.victory-burst-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 420px;
  height: 420px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.magic-burst {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: burst-spin 6s linear infinite;
  opacity: 0.9;
}

@keyframes burst-spin {
  from { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.06); }
  to { transform: rotate(360deg) scale(1); }
}

.wizard-victory-img {
  position: relative;
  width: 210px;
  animation: victory-bounce 0.6s ease-out;
}

@keyframes victory-bounce {
  0% { transform: translateY(40px) scale(0.85); opacity: 0; }
  60% { transform: translateY(-10px) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.victory-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 380px;
}

.panel-img {
  width: 280px;
  max-width: 100%;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.45));
}

.victory-headline {
  margin: 0;
  color: #fff6e0;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 3px 0 rgba(0,0,0,0.35), 0 6px 14px rgba(0,0,0,0.4);
}

.victory-line {
  margin: 0;
  color: #f0e6ff;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

#screen-victory .target-hint {
  margin-top: 2px;
  padding: 8px 14px;
}

#screen-victory .target-hint-icon {
  width: 44px;
  height: 44px;
}

#screen-victory .art-button {
  margin-top: 6px;
}

#screen-victory .art-button img {
  width: 210px;
}
