:root {
  --gold: #d4a84b;
  --gold-light: #f2d89a;
  --gold-glow: rgba(212, 168, 75, 0.5);
  --teal: #00d4aa;
  --teal-glow: rgba(0, 212, 170, 0.3);
  --bg-deep: #0f0a1e;
  --bg-card: rgba(18, 12, 36, 0.55);
  --text-primary: #faf0dd;
  --text-muted: #b0a090;
  --accent-0: #e84393;
  --accent-1: #2ecc71;
  --accent-2: #00cec9;
  --accent-glow-0: rgba(232, 67, 147, 0.4);
  --accent-glow-1: rgba(46, 204, 113, 0.4);
  --accent-glow-2: rgba(0, 206, 201, 0.4);
  --font-display: 'Cinzel', serif;
  --font-body: 'MedievalSharp', Georgia, serif;
  --radius: 20px;
}

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

html { scroll-behavior: smooth; }

body {
  min-height: calc(100dvh - 2rem);
  background: var(--bg-deep);
  font-family: var(--font-body);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  padding: 1rem;
  position: relative;
}

.music-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(212, 168, 75, 0.3);
  background: rgba(12, 8, 28, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--gold-light);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.music-toggle:hover {
  border-color: var(--gold);
  background: rgba(12, 8, 28, 0.9);
  box-shadow: 0 0 20px rgba(212, 168, 75, 0.2);
}

.music-toggle.playing {
  border-color: var(--accent-2);
  box-shadow: 0 0 15px rgba(0, 206, 201, 0.3);
  animation: pulse-glow 2s ease-in-out infinite;
}

.music-toggle.muted {
  opacity: 0.5;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 15px rgba(0, 206, 201, 0.2); }
  50% { box-shadow: 0 0 25px rgba(0, 206, 201, 0.4); }
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#gameView {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem 1rem;
  justify-content: center;
}

.mystical-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.header-ornament {
  font-size: 1.5rem;
  color: var(--gold-light);
  letter-spacing: 1rem;
  margin-bottom: 0.75rem;
  animation: shimmer 3s ease-in-out infinite;
}

.glitch-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  color: var(--gold-light);
  text-shadow:
    0 0 10px var(--gold-glow),
    0 0 30px var(--gold-glow),
    0 0 60px rgba(212, 168, 75, 0.15);
  letter-spacing: 0.08em;
  position: relative;
  line-height: 1.2;
}

.subtitle {
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  color: #c4b8a8;
  margin-top: 0.6rem;
  font-style: italic;
  letter-spacing: 0.05em;
}

.instruction {
  font-size: clamp(0.9rem, 1.8vw, 1.05rem);
  color: #c4b8a8;
  text-align: center;
  max-width: 520px;
  line-height: 1.5;
  margin-top: -0.5rem;
}

.portals-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  flex-wrap: wrap;
  perspective: 1200px;
}

.portal-card {
  flex: 1;
  min-width: 250px;
  max-width: 360px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 168, 75, 0.12);
  border-radius: var(--radius);
  padding: 2.5rem 1.8rem 1.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
  position: relative;
  opacity: 0;
  transform: translateY(80px) rotateX(20deg) scale(0.85);
}

.portal-card:hover {
  border-color: rgba(212, 168, 75, 0.3);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.portal-card[data-portal="0"] { --accent: var(--accent-0); --accent-glow: var(--accent-glow-0); --ring-w: 240px; --orbit-speed: 18s; --orbit-dir: normal; }
.portal-card[data-portal="1"] { --accent: var(--accent-1); --accent-glow: var(--accent-glow-1); --ring-w: 270px; --orbit-speed: 25s; --orbit-dir: reverse; }
.portal-card[data-portal="2"] { --accent: var(--accent-2); --accent-glow: var(--accent-glow-2); --ring-w: 240px; --orbit-speed: 22s; --orbit-dir: normal; }

.portal-center {
  transform: translateY(80px) rotateX(20deg) scale(0.85);
}

.portal-ring {
  position: relative;
  width: var(--ring-w, 240px);
  height: var(--ring-w, 240px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ring-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    var(--accent-glow) 0%,
    transparent 70%);
  opacity: 0.4;
  animation: breathe 4s ease-in-out infinite;
  filter: blur(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.portal-card:focus-within .ring-glow {
  opacity: 0.9;
  transform: scale(1.12);
}

.ring-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.25;
  animation: pulse-expand 3s ease-in-out infinite;
}

.ring-rotating {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px solid rgba(212, 168, 75, 0.15);
  animation: spin-ring var(--orbit-speed, 20s) linear infinite;
  animation-direction: var(--orbit-dir, normal);
}

@keyframes spin-ring {
  to { transform: rotate(360deg); }
}

.orb {
  position: absolute;
  top: -1px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold-glow);
  transform-origin: 3px calc(var(--ring-w) / 2 + 15px);
  transform: rotate(calc(var(--i) * 120deg));
}



.ring-image {
  width: 88%;
  height: 88%;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.portal-card:hover .ring-image img {
  transform: scale(1.08);
}

.portal-label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--gold-light);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
}

.portal-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 280px;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 0.9rem;
  color: var(--gold);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.portal-input-wrapper:focus-within .input-icon {
  opacity: 1;
  color: var(--accent);
}

.portal-input-wrapper input {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 2.4rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(212, 168, 75, 0.2);
  border-radius: 12px;
  color: var(--text-primary);
  text-align: left;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  letter-spacing: 0.05em;
}

.portal-input-wrapper input::placeholder {
  color: rgba(245, 230, 200, 0.35);
  font-style: italic;
  font-size: 0.9rem;
}

.portal-input-wrapper input:focus {
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 20px var(--accent-glow);
}

#unlockBtn {
  position: relative;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--gold-light);
  background: linear-gradient(135deg, rgba(212,168,75,0.15), rgba(212,168,75,0.05));
  border: 2px solid rgba(212,168,75,0.3);
  border-radius: 50px;
  padding: 1rem 3rem;
  cursor: pointer;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: all 0.4s ease;
  overflow: hidden;
  margin-top: 0.5rem;
}

.btn-border {
  position: absolute;
  inset: -2px;
  border-radius: 50px;
  background: conic-gradient(from 0deg, transparent, var(--teal), transparent 60%, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: -1;
}

#unlockBtn:hover {
  background: linear-gradient(135deg, rgba(212,168,75,0.25), rgba(212,168,75,0.1));
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212,168,75,0.15);
}

#unlockBtn:hover .btn-border {
  opacity: 0.6;
  animation: spin-slow 3s linear infinite;
}

#unlockBtn:active {
  transform: translateY(0);
}

#message {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-muted);
  min-height: 1.8rem;
  text-align: center;
  transition: color 0.3s ease;
}

#message.error { color: #ff6b6b; text-shadow: 0 0 10px rgba(255,107,107,0.3); }
#message.success { color: #00d4aa; text-shadow: 0 0 15px rgba(0,212,170,0.3); }

#treasureView {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}

#treasureView.visible {
  opacity: 1;
  pointer-events: auto;
}

.treasure-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #0a0520 0%, #03010a 100%);
}

.treasure-scroll {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  padding: 3rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
}

.treasure-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.countdown-section {
  position: relative;
  padding: 2rem;
}

.rays {
  position: absolute;
  inset: -30%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 1.5s ease 0.5s;
}

#treasureView.visible .rays { opacity: 1; }

.ray {
  position: absolute;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, transparent 0%, rgba(212,168,75,0.12) 50%, transparent 100%);
  transform-origin: center;
  transform: rotate(calc(var(--i) * 30deg));
  animation: ray-pulse 3s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.15s);
}

.treasure-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s;
  position: relative;
  z-index: 1;
}

#treasureView.visible .treasure-inner {
  opacity: 1;
  transform: scale(1);
}

.countdown-label {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

.countdown {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
}

.countdown-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.countdown-num {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  color: var(--gold-light);
  text-shadow:
    0 0 10px var(--gold-glow),
    0 0 30px rgba(212, 168, 75, 0.3);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: center;
}

.countdown-unit {
  font-size: clamp(0.6rem, 1.2vw, 0.75rem);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.countdown-sep {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  color: var(--teal);
  opacity: 0.5;
  margin-top: -0.15em;
  animation: cd-blink 1s step-end infinite;
}

.countdown-target {
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 1.5vw, 0.95rem);
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-top: 0.25rem;
}

@keyframes cd-blink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.15; }
}

.map-section {
  padding-top: 1rem;
  border-top: 1px solid rgba(212, 168, 75, 0.15);
}

.map-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: var(--gold-light);
  text-shadow: 0 0 10px var(--gold-glow);
  letter-spacing: 0.15em;
  text-align: center;
}

.map-subtitle {
  font-size: clamp(0.8rem, 1.5vw, 0.95rem);
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.3rem;
  margin-bottom: 1.5rem;
}

.ciukinverse-map {
  position: relative;
  width: 100%;
  max-width: 900px;
}

.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.map-path {
  fill: none;
  stroke: rgba(212, 168, 75, 0.2);
  stroke-width: 2;
  stroke-dasharray: 8 4;
}

.map-path.past {
  stroke: var(--gold);
  stroke-opacity: 0.4;
  stroke-dasharray: none;
}

.map-path.future {
  stroke: rgba(212, 168, 75, 0.15);
  stroke-dasharray: 4 6;
}

.map-path.fade-in {
  stroke-dashoffset: 400;
  animation: draw-path 1.5s ease forwards;
}

@keyframes draw-path {
  to { stroke-dashoffset: 0; }
}

.map-nodes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.3s ease;
}

.map-node.visible {
  opacity: 1;
}

.map-node:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.map-node.locked {
  cursor: default;
  opacity: 0.35;
  filter: grayscale(0.8);
}

.map-node.locked.visible {
  opacity: 0.35;
}

.map-node.locked:hover {
  transform: translate(-50%, -50%);
}

.node-portal {
  position: relative;
  width: clamp(50px, 8vw, 72px);
  height: clamp(50px, 8vw, 72px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--node-color, var(--gold));
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 12px var(--node-glow, rgba(212, 168, 75, 0.2)), inset 0 0 8px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.map-node:not(.locked):hover .node-portal {
  box-shadow: 0 0 20px var(--node-glow, rgba(212, 168, 75, 0.4)), inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.node-portal .node-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(212, 168, 75, 0.15);
  animation: spin-ring 15s linear infinite;
}

.map-node.locked .node-portal .node-ring {
  animation: none;
}

.node-portal-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.map-node.locked .lock-icon {
  position: absolute;
  font-size: 1.1rem;
  z-index: 2;
  filter: grayscale(1);
}

.node-label {
  font-family: var(--font-display);
  font-size: clamp(0.5rem, 0.9vw, 0.65rem);
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  max-width: 120px;
  line-height: 1.2;
}

.map-node:not(.locked) .node-label {
  color: var(--gold);
}

.map-node.current .node-label {
  color: var(--gold-light);
  text-shadow: 0 0 8px var(--gold-glow);
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 1rem;
}

.modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(3, 1, 10, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 168, 75, 0.2);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.visible .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(212, 168, 75, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.modal-close:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.modal-portal {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  overflow: hidden;
  margin-bottom: 0.5rem;
  box-shadow: 0 0 20px rgba(212, 168, 75, 0.2);
}

.modal-portal .node-portal-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.modal-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--gold-light);
  text-align: center;
  letter-spacing: 0.08em;
}

.modal-date {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.modal-desc {
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.6;
  opacity: 0.85;
}

.modal-link {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--teal);
  letter-spacing: 0.15em;
  text-decoration: none;
  border: 1px solid rgba(0, 212, 170, 0.3);
  border-radius: 50px;
  padding: 0.6rem 1.5rem;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
}

.modal-link:hover {
  background: rgba(0, 212, 170, 0.1);
  border-color: var(--teal);
  box-shadow: 0 0 15px rgba(0, 212, 170, 0.2);
}

.treasure-icon {
  font-size: clamp(4rem, 15vw, 8rem);
  filter: drop-shadow(0 0 20px rgba(212, 168, 75, 0.4)) drop-shadow(0 0 60px rgba(212, 168, 75, 0.2));
  animation: float 4s ease-in-out infinite;
}

.treasure-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.5rem, 5vw, 2.8rem);
  color: var(--gold-light);
  text-shadow:
    0 0 10px var(--gold-glow),
    0 0 30px var(--gold-glow);
  letter-spacing: 0.1em;
  text-align: center;
}

.treasure-text {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.6;
  max-width: 500px;
  opacity: 0.9;
  white-space: pre-line;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.treasure-seal {
  font-size: 1.2rem;
  color: var(--gold);
  letter-spacing: 0.8rem;
  margin-top: 0.5rem;
  animation: shimmer 3s ease-in-out infinite;
}

#treasureParticles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.treasure-particle {
  position: absolute;
  width: var(--size, 4px);
  height: var(--size, 4px);
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 4px var(--gold-glow), 0 0 10px rgba(212,168,75,0.2);
  pointer-events: none;
}

@keyframes breathe {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

@keyframes pulse-expand {
  0%, 100% { transform: scale(1); opacity: 0.25; }
  50% { transform: scale(1.12); opacity: 0.5; }
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

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

@keyframes ray-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@media (max-width: 1000px) {
  .portal-card { --ring-w: 210px; padding: 2rem 1.5rem 1.5rem; }
  .portal-center { --ring-w: 230px; }
  .portal-input-wrapper { max-width: 260px; }
}

@media (max-width: 900px) {
  body { padding: 0.75rem; }
  #gameView { gap: 1.5rem; padding: 1.5rem 0.5rem; }
  .portals-container { gap: 1rem; }
  .portal-card { min-width: 200px; max-width: 300px; --ring-w: 190px; }
  .portal-center { --ring-w: 210px; }
  .portal-label { font-size: 0.75rem; }
  .portal-input-wrapper { max-width: 240px; }
  .portal-input-wrapper input { padding: 0.8rem 0.9rem 0.8rem 2.2rem; font-size: 1rem; }
}

@media (max-width: 700px) {
  body { padding: 0.5rem; }
  #gameView { gap: 1.2rem; padding: 1rem 0.5rem; }
  .portals-container { flex-direction: column; align-items: center; }
  .portal-card {
    min-width: 0;
    max-width: 380px;
    width: 100%;
    padding: 2rem 1.8rem 1.5rem;
    --ring-w: 210px;
  }
  .portal-center { --ring-w: 220px; transform: translateY(0) rotateX(0) scale(1); }
  #unlockBtn {
    padding: 0.9rem 2rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 400px) {
  .portal-card { --ring-w: 180px; padding: 1.5rem 1.2rem 1.2rem; }
  .portal-center { --ring-w: 190px; }
  .portal-input-wrapper input { font-size: 0.95rem; padding: 0.7rem 0.8rem 0.7rem 2rem; }
}
