
/* ─── UI Overlays ────────────────────────────────────────────── */
.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.7);
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  pointer-events: auto;
}
.scores-wrapper {
  display: flex;
  align-items: center;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}



.modal {
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  opacity: 1;
  transition: opacity 0.3s ease;
}
.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: rgba(20, 24, 32, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 30px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  border: 1px solid rgba(80, 176, 255, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(32, 128, 224, 0.15);
  color: #ccc;
}

.modal-content h2 {
  margin-top: 0;
  color: #50B0FF;
  border-bottom: 1px solid rgba(80, 176, 255, 0.3);
  padding-bottom: 10px;
  margin-bottom: 15px;
  text-shadow: 0 0 10px rgba(80, 176, 255, 0.5);
  letter-spacing: 1px;
}

.modal-content h3 {
  margin-top: 20px;
  font-size: 1.1rem;
  color: #8fa0c0;
}

.modal-content ul {
  margin-left: 20px;
  margin-top: 5px;
  line-height: 1.5;
}

.modal-content ul ul {
  margin-top: 0;
  margin-bottom: 0;
  list-style-type: circle;
}

.legend {
  margin-top: 10px;
}
.legend-item {
  display: flex;
  align-items: start;
  margin-bottom: 10px;
  font-size: 0.95rem;
}
.legend-item .icon {
  margin-right: 10px;
  font-size: 1.2rem;
  width: 25px;
  text-align: center;
}
.legend-item .icon.star { color: #ffd700; }
.legend-item .icon.pearl { color: #e0e0e0; }
.legend-item .icon.bomb { color: #ff4444; }

.start-btn {
  display: block;
  width: 100%;
  margin-top: 25px;
  padding: 12px;
  background: #2080E0;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
.start-btn:hover {
  background: #3090F0;
}

/* High Scores */
.scores-btn {
  font-size: 1.1rem;
}

.high-scores-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.high-scores-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.high-scores-list li:last-child {
  border-bottom: none;
}
.high-scores-list .rank {
  font-weight: bold;
  color: #2080E0;
  width: 30px;
}
.high-scores-list .score {
  font-weight: bold;
  color: #fff;
}
.high-scores-list .date {
  color: #888;
  font-size: 0.9em;
}
/* Game Over Modal */
.gameover-message {
  font-size: 1.2rem;
  margin-bottom: 25px;
  color: #ccc;
  text-align: center;
}

.score-summary {
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 1.1rem;
}
.score-row:last-child {
  margin-bottom: 0;
}

.score-row span:first-child {
  color: #8fa0c0;
}

.score-row .val {
  font-weight: bold;
  color: #fff;
}

.text-center {
  text-align: center;
}

/* ─── Edgy Dropdown Selector ──────────────────────────────────── */
.edgy-dropdown {
  position: absolute;
  top: 60px; /* Below the logo */
  left: 16px;
  background: rgba(20, 24, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(80, 176, 255, 0.3);
  border-radius: 8px;
  padding: 16px;
  width: 220px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 15px rgba(32, 128, 224, 0.2);
  z-index: 400;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}

.edgy-dropdown.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.dropdown-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dropdown-header {
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: #50B0FF;
  text-transform: uppercase;
  margin: 0 0 4px 4px;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(80, 176, 255, 0.5);
}

.dropdown-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dropdown-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  padding: 10px 14px;
  border-radius: 6px;
  color: #ccc;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.dropdown-btn.hidden {
  display: none;
}

.dropdown-btn .icon {
  margin-right: 12px;
  font-size: 1.1rem;
}

.dropdown-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(4px);
}

.dropdown-btn.active {
  background: rgba(32, 128, 224, 0.15);
  border-color: rgba(80, 176, 255, 0.6);
  color: #fff;
  box-shadow: 0 0 10px rgba(32, 128, 224, 0.3) inset;
  text-shadow: 0 0 5px rgba(255,255,255,0.3);
}

.dropdown-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(80, 176, 255, 0.3), transparent);
  margin: 16px 0;
}

/* ─── Settings ──────────────────────────────────────────────── */
.settings-group { margin-bottom: 20px; }
.settings-desc { font-size: 0.9rem; color: #999; margin-bottom: 15px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.setting-row span { color: #ccc; font-weight: 500; }
.keybind-input {
  background: rgba(0,0,0,0.4);
  border: 1px solid #555;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  width: 100px;
  text-align: center;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}
.keybind-input:focus {
  outline: none;
  border-color: #2080E0;
  box-shadow: 0 0 0 2px rgba(32,128,224,0.3);
  background: rgba(32,128,224,0.1);
}

/* ─── End Session Animation ───────────────────────────────────── */
@keyframes shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-10px); }
  80% { transform: translateX(10px); }
  100% { transform: translateX(0); }
}

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

/* ─── Puzzle Mode ──────────────────────────────────────────────── */

/* ─── Unified Game HUD ───────────────────────────────────────── */
.game-hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: linear-gradient(to bottom, rgba(16, 12, 24, 0.95) 70%, rgba(16, 12, 24, 0));
  /* Solid cap covers the iOS status bar area so no light strip shows through */
  box-shadow: 0 -100px 0 100px #0d0a14;
  padding: 0 16px 20px;
  pointer-events: none;
  font-family: inherit;
}
.game-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: max(env(safe-area-inset-top, 8px), 8px);
  gap: 12px;
}

/* Left cluster: logo + mode meta */
.game-hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.game-hud-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.15s;
}
.game-hud-logo:hover {
  opacity: 0.8;
}
.game-hud-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.game-hud-mode {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #50B0FF;
  text-transform: uppercase;
  line-height: 1.2;
}
/* Mode-specific accent colors */
.game-hud[data-mode="puzzle"] .game-hud-mode { color: #8040c0; }
.game-hud[data-mode="chill"]  .game-hud-mode { color: #40c080; }

.game-hud-subtitle {
  font-size: 0.9rem;
  font-weight: 700;
  color: #d0d0d8;
  letter-spacing: 0.3px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-hud[data-mode="puzzle"] .game-hud-subtitle {
  color: #ffd740;
  text-shadow: 0 0 10px rgba(255, 215, 64, 0.3);
}

/* Right cluster */
.game-hud-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* Score display (arcade / chill) */
.game-hud-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}
.game-hud-score-label {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #606070;
}
.game-hud-score-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #d0d0d8;
  font-variant-numeric: tabular-nums;
}

/* Puzzle info group (moves + restart + progress) */
.game-hud-puzzle-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.game-hud-restart {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(128, 64, 192, 0.2);
  border: 1px solid rgba(128, 64, 192, 0.4);
  color: #c0a0e0;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.game-hud-restart:hover {
  background: rgba(128, 64, 192, 0.4);
  color: #fff;
}
.game-hud-restart:active {
  transform: scale(0.9);
}
.game-hud-moves {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}
.game-hud-moves-label {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #606070;
}
.game-hud-moves-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #d0d0d8;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}
.game-hud-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.game-hud-progress-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: #b070f0;
}
.game-hud-par {
  font-size: 0.65rem;
  color: #505060;
}

/* Phone: tighten spacing */
@media (max-width: 480px) {
  .game-hud { padding: 0 10px 16px; }
  .game-hud-logo { width: 32px; height: 32px; border-radius: 6px; }
  .game-hud-subtitle { font-size: 0.8rem; }
  .game-hud-moves-value { font-size: 1.3rem; }
  .game-hud-score-value { font-size: 1.3rem; }
  .game-hud-restart { width: 28px; height: 28px; font-size: 0.9rem; }
  .icon-btn { width: 32px; height: 32px; font-size: 0.9rem; }
}

/* Sector header in puzzle selector */
.puzzle-sector-header {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(128, 64, 192, 0.4);
  color: #b070f0;
  text-shadow: 0 0 8px rgba(128, 64, 192, 0.5);
}

.puzzle-sector-locked .puzzle-sector-header {
  color: #555;
  text-shadow: none;
  border-bottom-color: #333;
}

/* Individual puzzle row button */
.puzzle-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #d0d0d8;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-align: left;
  font-family: inherit;
}

.puzzle-select-btn:hover {
  border-color: #8040c0;
  background: rgba(128, 64, 192, 0.12);
  transform: translateX(3px);
}

.puzzle-select-btn .puzzle-btn-name {
  font-weight: 600;
  margin-bottom: 2px;
  color: #e0d8f0;
}

.puzzle-select-btn .puzzle-btn-meta {
  color: #707080;
  font-size: 0.73rem;
}

.puzzle-btn-stars {
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-left: 10px;
  letter-spacing: 1px;
}

/* Puzzle modal headings use purple accent */
#modal-puzzle-select h2,
#modal-puzzle-result h2 {
  color: #b070f0;
  border-bottom-color: rgba(128, 64, 192, 0.4);
  text-shadow: 0 0 10px rgba(128, 64, 192, 0.5);
}

/* Star display in result modal */
#puzzle-result-stars {
  letter-spacing: 3px;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
  animation: star-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.5) both;
}

@keyframes star-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}

#btn-puzzle-failed-dismiss:hover {
  color: #a0a0b0;
}

/* Failed modal orange accent */
#modal-puzzle-failed h2 {
  color: #ff9030;
  border-bottom-color: rgba(255, 144, 48, 0.4);
  text-shadow: 0 0 10px rgba(255, 144, 48, 0.4);
}

/* Daily puzzle badge */
.daily-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffd700;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Puzzle editor textarea */
.puzzle-editor-board {
  width: 100%;
  background: rgba(0,0,0,0.5);
  border: 1px solid #444;
  border-radius: 4px;
  color: #c0d8a0;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  padding: 10px;
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
}

.puzzle-editor-board:focus {
  outline: none;
  border-color: #8040c0;
  box-shadow: 0 0 0 2px rgba(128, 64, 192, 0.25);
}

.puzzle-editor-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.puzzle-editor-row label {
  font-size: 0.75rem;
  color: #8080a0;
  width: 80px;
  flex-shrink: 0;
}

.puzzle-editor-input {
  background: rgba(0,0,0,0.4);
  border: 1px solid #444;
  border-radius: 4px;
  color: #d0d0d8;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.puzzle-editor-input:focus {
  outline: none;
  border-color: #8040c0;
}

.share-code-box {
  background: rgba(0,0,0,0.5);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 8px 10px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #90d090;
  word-break: break-all;
  margin-top: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.share-code-box:hover {
  border-color: #8040c0;
}

.copy-confirm {
  font-size: 0.7rem;
  color: #60d060;
  margin-top: 4px;
  height: 14px;
  transition: opacity 0.3s;
}
