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

:root {
  --bg-primary: #f5f0e8;
  --bg-secondary: #ece4d8;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f4ec;
  --text-primary: #2a2218;
  --text-secondary: #6a5a48;
  --text-muted: #a09080;
  --accent-gold: #c9a84c;
  --accent-brass: #a0843a;
  --accent-red: #b85a4a;
  --accent-amber: #b8943a;
  --accent-jewel: #7a6a8a;
  --border-color: #d8d0c4;
  --border-light: #e0d8cc;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
}

#app {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.app-logo {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.app-logo span {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-brass));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.app-main {
  flex: 1;
  padding: 24px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.screen {
  display: none;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-header {
  margin-bottom: 24px;
}

.screen-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.screen-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* === WORLD LIST === */

#world-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.world-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.world-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateX(4px);
}

.world-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.world-card.locked:hover {
  transform: none;
  background: var(--bg-card);
}

.world-icon {
  font-size: 36px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.03);
  border-radius: 12px;
  flex-shrink: 0;
}

.world-info {
  flex: 1;
  min-width: 0;
}

.world-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 2px;
}

.world-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.world-progress-bar {
  height: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.world-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-brass));
  border-radius: 2px;
  transition: width 0.4s ease;
}

.world-stars {
  font-size: 14px;
  letter-spacing: 2px;
}

.lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 23, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.lock-overlay span {
  font-size: 28px;
  letter-spacing: 4px;
  color: var(--text-muted);
}

#total-progress {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-value {
  font-size: 18px;
  letter-spacing: 3px;
}

/* === MISSION LIST === */

#mission-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.mission-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.mission-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.mission-formula {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-jewel));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mission-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.mission-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.mission-count {
  color: var(--text-secondary);
  font-size: 13px;
}

.egg-indicator {
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent-amber);
  font-weight: 500;
}

/* === GAME SCREEN === */

#screen-game {
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.game-header-left h2 {
  font-size: 18px;
  font-weight: 600;
}

.game-header-left .game-mission-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.game-header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.game-main {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.game-canvas-wrap {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  min-height: 400px;
}

#molecule-canvas {
  width: 700px;
  height: 450px;
  display: block;
  cursor: default;
  margin: auto;
}

.canvas-replay-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.2s;
  line-height: 1;
}

.canvas-replay-btn:hover {
  opacity: 1;
  background: var(--accent-gold);
  color: #0a0e17;
}

.game-panel-right {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

.panel-box h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.game-formula {
  font-size: 15px;
  line-height: 1.8;
}

.formula-el {
  font-weight: 600;
  font-size: 15px;
}

.formula-el.match {
  color: var(--accent-brass);
}

.formula-el.mismatch {
  color: var(--accent-red);
}

.formula-el.extra {
  color: var(--accent-amber);
}

.formula-el.target {
  color: var(--text-muted);
}

.formula-sep {
  color: var(--text-muted);
  font-size: 13px;
}

.formula-gap {
  margin-right: 4px;
}

.game-status {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.game-status.idle { color: var(--accent-amber); background: rgba(185,148,58,0.1); }
.game-status.complete { color: var(--accent-brass); background: rgba(184,148,58,0.1); }
.game-status.building { color: var(--accent-gold); background: rgba(212,168,72,0.1); }
.game-status.error { color: var(--accent-red); background: rgba(184,90,74,0.1); }

.toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tool-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tool-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.tool-btn.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.tool-select { font-size: 16px; }
.tool-delete { font-size: 18px; font-weight: 700; color: var(--accent-red); }
.tool-bond { font-size: 18px; }

.tool-description {
  width: 100%;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 4px 0;
  margin-top: 4px;
  border-top: 1px solid var(--border-color);
  min-height: 20px;
}

.game-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent-gold);
  color: #0a0e17;
}

.btn-primary:hover {
  background: #c9a84c;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-danger {
  background: rgba(184,90,74,0.15);
  color: var(--accent-red);
  border: 1px solid rgba(184,90,74,0.3);
}

.btn-danger:hover {
  background: rgba(184,90,74,0.25);
}

.game-hints {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  min-height: 40px;
}

#found-list {
  max-height: 160px;
  overflow-y: auto;
}

.found-item {
  font-size: 13px;
  padding: 4px 0;
  color: var(--accent-brass);
}

.found-item.egg {
  color: var(--accent-amber);
}

.found-rarity {
  font-size: 10px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.found-rarity.common { background: rgba(100,100,100,0.2); color: var(--text-muted); }
.found-rarity.rare { background: rgba(185,148,58,0.2); color: var(--accent-amber); }

.found-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* === 3D VIEWER === */

#panel-3d {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
}

#panel-3d h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#viewer-3d-container {
  min-height: 260px;
}

.viewer-error {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

/* === RESULT MODAL === */

.result-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.result-modal.visible {
  display: flex;
}

.result-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: modalSlideIn 0.3s ease;
  border-top: 3px solid;
}

@keyframes modalSlideIn {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.result-icon {
  font-size: 48px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.result-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.result-message {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.result-detail {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 8px 0;
}

.result-fact {
  display: block;
  font-size: 12px;
  color: var(--accent-amber);
  font-style: italic;
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(185,148,58,0.08);
  border-radius: 6px;
}

.result-new-badge {
  display: inline-block;
  background: var(--accent-brass);
  color: #0a0e17;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 12px;
  border-radius: 4px;
  margin: 8px 0;
  animation: pulse 1s ease infinite;
}

.result-old-badge {
  display: inline-block;
  color: var(--text-muted);
  font-size: 12px;
  margin: 8px 0;
}

.auto-clear-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.auto-clear-row.remember {
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 0;
}

.auto-clear-row input[type="checkbox"] {
  accent-color: var(--accent-gold);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.result-actions {
  margin-top: 16px;
}

.result-actions .btn {
  width: 100%;
  justify-content: center;
}

/* === COLLECTION === */

#collection-grid {
  display: flex;
  flex-direction: column;
}

.collection-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: all 0.2s;
}

.collection-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.collection-card.rare-card {
  border-color: var(--accent-amber);
  background: linear-gradient(135deg, var(--bg-card), #f5f0e4);
}

.card-replay {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 14px;
  background: rgba(212,168,72,0.1);
  border: 1px solid rgba(212,168,72,0.3);
  border-radius: 6px;
  font-size: 12px;
  color: #c9a84c;
  cursor: pointer;
  transition: all 0.2s;
}
.card-replay:hover {
  background: rgba(212,168,72,0.2);
}

.card-rarity {
  font-size: 24px;
  margin-bottom: 8px;
}

.card-formula {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-mol {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
  min-height: 70px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.card-fact {
  font-size: 11px;
  color: var(--accent-amber);
  font-style: italic;
  padding: 6px 8px;
  background: rgba(185,148,58,0.06);
  border-radius: 4px;
  margin-bottom: 8px;
}

.card-world {
  font-size: 11px;
  color: var(--text-muted);
}

.collection-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

.collection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* === TUTORIAL === */

.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  pointer-events: none;
}

.tutorial-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  transition: all 0.3s;
}

.tutorial-highlight {
  position: absolute;
  border-radius: 8px;
  box-shadow: 0 0 0 4px var(--accent-gold), 0 0 0 9999px rgba(0,0,0,0.65);
  transition: all 0.3s;
  pointer-events: none;
}

.tutorial-card {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 90%;
  pointer-events: all;
  z-index: 2001;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.tutorial-step-indicator {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.tutorial-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.tutorial-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.tutorial-buttons {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.tutorial-skip {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 8px 12px;
}

.tutorial-skip:hover {
  color: var(--text-secondary);
}

.tutorial-next {
  background: var(--accent-gold);
  color: #0a0e17;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.tutorial-next:hover {
  background: #c9a84c;
}

/* === SCROLLBAR === */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === RESPONSIVE === */

sub {
  font-size: 0.7em;
}

.dialogue-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 999;
}

#dialogue-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

#dialogue-box {
  position: relative;
  z-index: 1001;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-image: linear-gradient(135deg, var(--accent-gold), var(--accent-brass)) 1;
  border-radius: 10px;
  width: 90%;
  max-width: 620px;
  min-height: 140px;
  padding: 24px 28px 20px;
  display: flex;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.dialogue-char-area {
  flex-shrink: 0;
  width: 64px;
}

#dialogue-character {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-brass));
  opacity: 0;
  transition: opacity 0.3s;
}

.dialogue-content {
  flex: 1;
  min-width: 0;
}

#dialogue-speaker {
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-gold);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#dialogue-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  min-height: 40px;
}

#dialogue-continue {
  margin-top: 16px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-brass));
  border: none;
  color: #0a0e17;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

#dialogue-continue:hover {
  opacity: 0.85;
}

#dialogue-skip {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  z-index: 1;
}

#dialogue-skip:hover {
  background: rgba(184,90,74,0.2);
  border-color: rgba(184,90,74,0.4);
  color: #b85a4a;
}

.tool-tutorial-tip svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.tool-tutorial-tip line {
  stroke: rgba(212,168,72,0.5);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.tool-tutorial-title {
  font-size: 15px;
  font-weight: 700;
  color: #c9a84c;
  margin-bottom: 6px;
}

.tool-tutorial-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.tool-tutorial-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tool-tutorial-counter {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
}

.tool-tutorial-skip {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.tool-tutorial-skip:hover {
  background: rgba(184,90,74,0.2);
  border-color: rgba(184,90,74,0.4);
  color: #b85a4a;
}

.tool-tutorial-highlight {
  position: relative;
  z-index: 902 !important;
  animation: tool-glow 1.2s ease-in-out infinite alternate;
  box-shadow: 0 0 0 3px rgba(212,168,72,0.6), 0 0 20px rgba(212,168,72,0.3) !important;
  border-color: #c9a84c !important;
}

@keyframes tool-glow {
  from { box-shadow: 0 0 0 3px rgba(212,168,72,0.4), 0 0 12px rgba(212,168,72,0.2); }
  to { box-shadow: 0 0 0 5px rgba(212,168,72,0.7), 0 0 28px rgba(212,168,72,0.4); }
}

/* === TOOL TUTORIAL OVERLAY === */

.tool-tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 1004;
}

.tool-tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}

.tool-tutorial-tip {
  position: absolute;
  width: 260px;
  background: #2a2a3a;
  border: 1px solid rgba(212,168,72,0.5);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  z-index: 1005;
}

.challenge-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.challenge-header h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
}
.challenge-header #challenge-world-name {
  color: var(--text-secondary);
  font-size: 14px;
}
.challenge-body {
  max-width: 600px;
  margin: 0 auto;
}
.challenge-progress-bar {
  text-align: center;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}
.challenge-question {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  line-height: 1.5;
}
.challenge-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.challenge-option {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-primary);
  text-align: left;
  transition: all 0.2s;
  font-family: inherit;
}
.challenge-option:hover:not(:disabled) {
  background: rgba(212,168,72,0.08);
  border-color: rgba(212,168,72,0.3);
}
.challenge-option:disabled {
  cursor: default;
  opacity: 0.7;
}
.challenge-option-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.challenge-option.selected-correct {
  border-color: #b8943a;
  background: rgba(184,148,58,0.15);
}
.challenge-option.selected-wrong {
  border-color: #c4665a;
  background: rgba(184,90,74,0.15);
}
.challenge-option.correct-answer {
  border-color: #b8943a;
  background: rgba(184,148,58,0.08);
}
.challenge-result {
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.challenge-result.correct {
  background: rgba(184,148,58,0.1);
  border: 1px solid rgba(184,148,58,0.3);
}
.challenge-result.wrong {
  background: rgba(184,90,74,0.1);
  border: 1px solid rgba(184,90,74,0.3);
}
.challenge-result .result-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.challenge-result .result-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}
#challenge-next-btn {
  margin-top: 4px;
}
.challenge-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(212,168,72,0.08), rgba(184,148,58,0.08));
  border: 1px solid rgba(212,168,72,0.3);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.challenge-btn:hover {
  border-color: #c9a84c;
  box-shadow: 0 4px 20px rgba(212,168,72,0.15);
}
.challenge-btn.locked {
  opacity: 0.5;
  cursor: default;
}
.challenge-btn.locked:hover {
  border-color: rgba(212,168,72,0.3);
  box-shadow: none;
}
.challenge-btn-icon {
  font-size: 28px;
  width: 48px;
  text-align: center;
}
.challenge-btn-info {
  flex: 1;
}
.challenge-btn-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #c9a84c;
}
.challenge-btn-desc {
  font-size: 13px;
  color: var(--text-secondary);
}
#challenge-intro-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}
.challenge-intro-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}
.challenge-intro-box {
  position: relative;
  z-index: 901;
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 480px;
  width: 90%;
  text-align: center;
}
.challenge-intro-speaker {
  font-weight: 700;
  font-size: 14px;
  color: #c9a84c;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.challenge-intro-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 20px;
}
#vision-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}
.vision-backdrop {
  position: absolute;
  inset: 0;
  background: #000;
}
.vision-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.vision-caption {
  position: relative;
  z-index: 1;
  max-width: 500px;
  padding: 0 24px;
  text-align: center;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}
.vision-dialogue {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: 10px;
  padding: 24px 28px;
  max-width: 520px;
  width: 90%;
}
.vision-speaker {
  font-weight: 700;
  font-size: 14px;
  color: #c9a84c;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.vision-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.vision-next {
  background: linear-gradient(135deg, #c9a84c, #b8943a);
  border: none;
  color: #0a0e17;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.vision-next:hover {
  opacity: 0.85;
}

/* === VISION CHARACTER PORTRAITS (comic-style) === */

.vision-char {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  position: absolute;
  top: -24px;
  left: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* === VISION EXPERIMENT / CHOICE / BRANCH === */

.vision-exp-box {
  max-width: 560px;
}

.exp-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.vision-exp-prompt {
  margin-bottom: 16px;
  font-weight: 600;
}

.vision-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.vision-choice {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
}

.vision-choice:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
}

.vision-choice.tried {
  opacity: 0.4;
  text-decoration: line-through;
}

.vision-choice:disabled {
  cursor: default;
}

.vision-choice.correct {
  background: #d4edc9;
  border-color: #5a9e4a;
  color: #2a5a1e;
}

.vision-choice.wrong {
  background: #f0d8d0;
  border-color: #c4665a;
  color: #7a2a1e;
}

.vision-branch-context {
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.vision-exp-result {
  margin-bottom: 16px;
  line-height: 1.7;
}

#choice-feedback {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

/* === AI CHAT (vision overlay) === */

.ai-ask-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.ai-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.ai-input:focus {
  border-color: var(--accent-gold);
}

.ai-send {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-brass));
  border: none;
  color: #0a0e17;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  flex-shrink: 0;
}

.ai-send:hover {
  opacity: 0.85;
}

.ai-send:disabled, .ai-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-history {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.ai-msg {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.ai-msg-user {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  align-self: flex-end;
}

.ai-msg-bot {
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.2);
  align-self: flex-start;
}

.exp-custom-area {
  padding-top: 8px;
}

/* === SETTINGS MODAL === */

.settings-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.settings-box {
  position: relative;
  z-index: 1201;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow);
}

.settings-box h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.settings-box p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.settings-box a {
  color: var(--accent-gold);
}

.settings-box input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  margin-bottom: 12px;
}

.settings-box input:focus {
  border-color: var(--accent-gold);
}

.settings-box .btn-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* === ACHIEVEMENTS SECTION (in Collection page) === */

.ach-section {
  margin-bottom: 8px;
}

.ach-section h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--accent-gold);
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.ach-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: opacity 0.2s;
  flex-wrap: wrap;
}

.ach-card.locked {
  opacity: 0.5;
}

.ach-badge {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.ach-badge.ach-unlocked {
  background: rgba(201,168,76,0.15);
}

.ach-badge.ach-secret {
  background: rgba(100,100,100,0.15);
  font-size: 18px;
}

.ach-badge.ach-locked {
  background: rgba(100,100,100,0.1);
  font-size: 16px;
}

.ach-badge.boss-none,
.ach-badge.tier-none {
  background: rgba(100,100,100,0.1);
}

.ach-badge.tier-bronze {
  background: rgba(205,127,50,0.2);
}

.ach-badge.tier-silver {
  background: rgba(192,192,192,0.2);
}

.ach-badge.tier-gold {
  background: rgba(255,215,0,0.2);
}

.ach-badge.tier-diamond {
  background: rgba(185,242,255,0.2);
}

.ach-badge.tier-crown {
  background: rgba(255,215,0,0.3);
  box-shadow: 0 0 12px rgba(255,215,0,0.4);
}

.ach-info {
  flex: 1;
  min-width: 0;
}

.ach-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.ach-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
  word-break: break-all;
}

.ach-condition {
  font-size: 10px;
  color: var(--text-muted, #999);
  margin-top: 1px;
  word-break: break-all;
}

.ach-check {
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.ach-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.ach-bar-fill {
  height: 100%;
  background: var(--accent-gold);
  border-radius: 2px;
  transition: width 0.3s;
}

.collection-divider {
  height: 1px;
  background: var(--border-color);
  margin: 20px 0;
}

/* === COLLECTION MOLECULES GROUPED === */

details.collection-world-group {
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

details.collection-world-group summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  list-style: none;
}

details.collection-world-group summary::-webkit-details-marker {
  display: none;
}

details.collection-world-group summary::before {
  content: '▶';
  font-size: 10px;
  color: var(--text-secondary);
  transition: transform 0.2s;
  margin-right: 4px;
}

details.collection-world-group[open] summary::before {
  content: '▼';
}

.mission-section {
  padding: 0 16px 12px;
}

.mission-section:last-child {
  padding-bottom: 16px;
}

.mission-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 0 6px;
}

.collection-mol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

/* === ACHIEVEMENT TOAST === */

.ach-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  max-width: 340px;
  transform: translateX(120%);
  transition: transform 0.4s ease;
}

.ach-toast.visible {
  transform: translateX(0);
}

.ach-toast-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.ach-toast-body {
  flex: 1;
}

.ach-toast-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  font-weight: 700;
}

.ach-toast-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.ach-toast-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* === ISOMER EXAMPLE MODAL === */

#isomer-example-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
}

.example-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.example-content {
  position: relative;
  z-index: 1003;
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 520px;
  width: 90%;
  text-align: center;
}

.example-content h3 {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--accent-gold);
}

.example-molecules {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.example-svg {
  width: 200px;
  height: 120px;
  border-radius: 8px;
  background: #f5f0e8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.example-vs {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-gold);
}

.example-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

#example-close {
  margin-top: 16px;
}

/* === BATTLE SCREEN === */

#battle-arena {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 185px;
  padding: 12px 4px 20px;
  border-bottom: 1px solid var(--border-color);
}
.battle-fighter { width: 44%; text-align: center; color: #60765d; }
.battle-fighter.guardian { color: #b26951; }
.battle-avatar { width: 100%; max-width: 200px; margin: 0 auto 8px; }
.battle-avatar svg { display: block; width: 100%; height: auto; }
.battle-avatar { transform-origin: center; }
.battle-avatar svg { transform-origin: 50% 60%; animation: molecule-sway 2.4s ease-in-out infinite alternate; }
.guardian .battle-avatar svg { animation-delay: -.9s; }
@keyframes molecule-sway {
  from { transform: translateY(2px) rotate(-3deg) scale(1.03,.97); }
  to { transform: translateY(-3px) rotate(3deg) scale(.97,1.03); }
}
.battle-fighter strong { display: block; font-size: 13px; line-height: 1.4; }
.battle-impact { position: absolute; left: 46%; top: 38%; font-size: 40px; color: var(--accent-gold); opacity: 0; }
.battle-float { position: absolute; top: 25%; font-size: 24px; font-weight: 800; color: #a74f3e; transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) {
  #screen-battle { animation: none; }
  .battle-avatar svg { animation: none; }
}

#screen-battle {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.battle-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.battle-header h2 {
  font-size: 18px;
  color: var(--accent-gold);
}

.battle-boss-area {
  text-align: center;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

#battle-boss-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-red);
  margin-bottom: 12px;
}

.battle-hp-bar {
  position: relative;
  height: 24px;
  background: #e8ddd0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.battle-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), #d4845a);
  border-radius: 12px;
  transition: width 0.4s ease;
}

.battle-hp-bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #2a2218;
}

.battle-hp-bar.player .battle-hp-fill {
  background: linear-gradient(90deg, var(--accent-brass), var(--accent-gold));
}

.battle-hp-bar.player {
  background: #e8ddd0;
}

#battle-boss-status {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-amber);
}

.battle-log {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  min-height: 60px;
  max-height: 120px;
  overflow-y: auto;
}

.battle-log-line {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 2px 0;
}

.battle-log-line:first-child {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.battle-player-area {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

.battle-player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.battle-player-info .battle-hp-bar {
  flex: 1;
  margin: 0;
  max-width: none;
}

.battle-hand-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.battle-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.battle-card {
  width: 120px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.battle-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.battle-card-used {
  opacity: 0.3;
  cursor: default;
  transform: none !important;
  box-shadow: none !important;
}

.battle-card-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.battle-card-type {
  font-size: 10px;
  color: var(--accent-gold);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.battle-card-atk {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-red);
}

.battle-card-unstable {
  font-size: 10px;
  color: var(--accent-amber);
  margin-top: 2px;
}

.battle-card-recoil {
  font-size: 9px;
  color: #b85a4a;
}

.battle-card-heal {
  font-size: 9px;
  color: #a0843a;
}

.battle-card-poison {
  font-size: 9px;
  color: var(--accent-jewel);
}

.battle-card-def {
  font-size: 9px;
  color: var(--accent-amber);
}

.battle-no-cards {
  color: var(--accent-red);
  font-size: 14px;
  padding: 20px;
  text-align: center;
  width: 100%;
}

.battle-card-basic {
  background: var(--bg-card);
  border-color: var(--accent-gold);
}

.battle-card-basic:hover {
  border-color: var(--accent-brass);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.boss-challenge-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.boss-challenge-btn:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.boss-challenge-btn.locked {
  opacity: 0.5;
  cursor: default;
}

.boss-challenge-btn.locked:hover {
  border-color: var(--border-color);
  box-shadow: none;
}

.boss-challenge-btn.defeated {
  border-color: var(--accent-brass);
  cursor: default;
  opacity: 0.8;
}

.boss-challenge-btn.defeated:hover {
  border-color: var(--accent-brass);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.boss-challenge-icon {
  font-size: 28px;
  width: 48px;
  text-align: center;
}

.boss-challenge-info {
  flex: 1;
}

.boss-challenge-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.boss-challenge-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* === RESPONSIVE (medium) === */

@media (max-width: 768px) {
  .app-main {
    padding: 16px;
  }

  .game-main {
    flex-direction: column;
  }

  .game-panel-right {
    width: 100%;
  }

  #molecule-canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 700 / 450;
  }

  #collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .world-card {
    padding: 16px;
  }

  .world-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 600px) {
  .battle-card {
    width: calc(50% - 8px);
  }
  #dialogue-box {
    padding: 16px;
    flex-direction: column;
  }
  .dialogue-char-area {
    display: none;
  }
}
/* Maintenance notices use Alan's existing warm palette without changing the layout. */
.preview-note, #storage-notice { font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
#storage-notice { padding: 10px; border: 1px solid var(--accent-brass); border-radius: 8px; }
