/* BowStack — UI Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a0f1e;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

/* --- Overlays --- */

.ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: env(safe-area-inset-top, 0px);
  z-index: 10;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* --- Title / Main Menu --- */

.game-title {
  font-size: 4.5rem;
  font-weight: 900;
  color: #F0E6F0;
  text-align: center;
  line-height: 1.05;
  text-shadow: 0 0 30px rgba(232, 72, 85, 0.4), 0 3px 0 rgba(0,0,0,0.3);
  letter-spacing: -2px;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 40px;
  pointer-events: auto;
  width: 220px;
}

.menu-item {
  padding: 14px 24px;
  border: 2px solid rgba(232, 72, 85, 0.25);
  border-radius: 12px;
  background: rgba(232, 72, 85, 0.06);
  color: #F0E6F0;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  text-align: center;
}

.menu-item:active {
  transform: scale(0.95);
  background: rgba(232, 72, 85, 0.18);
  border-color: rgba(232, 72, 85, 0.6);
}

/* --- Screen Title (subpages) --- */

.screen-title {
  font-size: 2rem;
  font-weight: 900;
  color: #F0E6F0;
  text-shadow: 0 0 20px rgba(232, 72, 85, 0.3), 0 2px 0 rgba(0,0,0,0.3);
}

/* --- Back Button --- */

.back-btn {
  margin-top: 36px;
  padding: 10px 32px;
  border: 2px solid rgba(240, 230, 240, 0.2);
  border-radius: 10px;
  background: rgba(240, 230, 240, 0.05);
  color: rgba(240, 230, 240, 0.6);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s, background 0.15s;
}

.back-btn:active {
  transform: scale(0.95);
  background: rgba(240, 230, 240, 0.15);
}

/* --- Mode Select --- */

.mode-buttons {
  display: flex;
  gap: 14px;
  margin-top: 32px;
  pointer-events: auto;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 24px;
  border: 2px solid rgba(232, 72, 85, 0.3);
  border-radius: 14px;
  background: rgba(232, 72, 85, 0.08);
  color: #F0E6F0;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  min-width: 130px;
}

.mode-btn:active {
  transform: scale(0.95);
  background: rgba(232, 72, 85, 0.18);
  border-color: rgba(232, 72, 85, 0.6);
}

.mode-btn-accent {
  border-color: rgba(255, 111, 89, 0.35);
  background: rgba(255, 111, 89, 0.08);
}

.mode-btn-accent:active {
  background: rgba(255, 111, 89, 0.18);
  border-color: rgba(255, 111, 89, 0.6);
}

.mode-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #F0E6F0;
}

.mode-btn-accent .mode-name {
  color: #FF6F59;
}

.mode-desc {
  font-size: 0.8rem;
  color: rgba(240, 230, 240, 0.5);
  margin-top: 4px;
  font-weight: 500;
}

.mode-high {
  font-size: 0.75rem;
  color: rgba(232, 72, 85, 0.6);
  margin-top: 10px;
  font-weight: 600;
}

.mode-btn-accent .mode-high {
  color: rgba(255, 111, 89, 0.5);
}

/* --- Best Scores --- */

.scores-list {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 240px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border: 2px solid rgba(232, 72, 85, 0.15);
  border-radius: 12px;
  background: rgba(232, 72, 85, 0.05);
}

.score-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(240, 230, 240, 0.7);
}

.score-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: #FF6F59;
  text-shadow: 0 0 10px rgba(255, 111, 89, 0.2);
}

/* --- Settings --- */

.settings-list {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 240px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border: 2px solid rgba(232, 72, 85, 0.15);
  border-radius: 12px;
  background: rgba(232, 72, 85, 0.05);
}

.setting-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(240, 230, 240, 0.7);
}

.toggle-btn {
  padding: 6px 18px;
  border: 2px solid rgba(232, 72, 85, 0.4);
  border-radius: 8px;
  background: rgba(232, 72, 85, 0.15);
  color: #F0E6F0;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  min-width: 60px;
  transition: transform 0.15s, background 0.15s;
}

.toggle-btn:active {
  transform: scale(0.95);
}

.toggle-btn.off {
  border-color: rgba(240, 230, 240, 0.15);
  background: rgba(240, 230, 240, 0.05);
  color: rgba(240, 230, 240, 0.35);
}

/* --- About --- */

.about-content {
  margin-top: 32px;
  text-align: center;
}

.about-name {
  font-size: 1.6rem;
  font-weight: 900;
  color: #F0E6F0;
}

.about-version {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(240, 230, 240, 0.35);
  margin-top: 4px;
}

.about-studio {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(232, 72, 85, 0.8);
  margin-top: 20px;
}

.about-desc {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(240, 230, 240, 0.45);
  margin-top: 12px;
  line-height: 1.5;
}

.about-links {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(232, 72, 85, 0.8);
  text-decoration: none;
}

/* --- Game Over --- */

.gameover-title {
  font-size: 2.5rem;
  font-weight: 900;
  color: #F0E6F0;
  text-shadow: 0 0 20px rgba(232, 72, 85, 0.3), 0 2px 0 rgba(0,0,0,0.3);
}

.final-score {
  font-size: 5rem;
  font-weight: 900;
  color: #FF6F59;
  line-height: 1;
  margin-top: 8px;
  text-shadow: 0 0 20px rgba(255, 111, 89, 0.3), 0 3px 0 rgba(0,0,0,0.2);
}

.final-detail {
  font-size: 1.1rem;
  color: rgba(240, 230, 240, 0.5);
  margin-top: 6px;
  font-weight: 600;
}

.high-score {
  font-size: 1.1rem;
  color: rgba(232, 72, 85, 0.7);
  margin-top: 12px;
  font-weight: 600;
}

.new-record {
  font-size: 1.3rem;
  font-weight: 700;
  color: #FF6F59;
  margin-top: 10px;
  animation: recordPop 0.6s ease-out;
}

.lb-btn {
  margin-top: 16px;
  padding: 10px 28px;
  border: 2px solid rgba(232, 72, 85, 0.4);
  border-radius: 10px;
  background: rgba(232, 72, 85, 0.1);
  color: rgba(240, 230, 240, 0.9);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

.lb-btn:active {
  background: rgba(232, 72, 85, 0.25);
}

.gameover-buttons {
  display: flex;
  gap: 14px;
  margin-top: 32px;
  pointer-events: auto;
}

@keyframes recordPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

/* --- In-Game HUD --- */

#ui-hud {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 5;
  pointer-events: none;
}

#hud-left {
  display: flex;
  flex-direction: column;
}

#hud-right {
  text-align: right;
}

#level-display {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(232, 72, 85, 0.8);
}

#lines-display {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(240, 230, 240, 0.4);
}

#score-display {
  font-size: 2rem;
  font-weight: 900;
  color: #F0E6F0;
  text-shadow: 0 0 10px rgba(232, 72, 85, 0.3);
}

#combo-display {
  display: inline-block;
  font-size: 1.2rem;
  font-weight: 800;
  color: #FF6F59;
  margin-left: 4px;
  vertical-align: super;
  animation: comboPop 0.3s ease-out;
}

@keyframes comboPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- Light Theme --- */

[data-theme="light"] body,
[data-theme="light"] html {
  background: #F5F0EB;
}

[data-theme="light"] .game-title {
  color: #2A1F2D;
  text-shadow: 0 0 30px rgba(180, 60, 70, 0.25), 0 3px 0 rgba(0,0,0,0.1);
}

[data-theme="light"] .menu-item {
  border-color: rgba(180, 60, 70, 0.2);
  background: rgba(180, 60, 70, 0.06);
  color: #2A1F2D;
}

[data-theme="light"] .menu-item:active {
  background: rgba(180, 60, 70, 0.15);
  border-color: rgba(180, 60, 70, 0.5);
}

[data-theme="light"] .screen-title {
  color: #2A1F2D;
  text-shadow: 0 0 20px rgba(180, 60, 70, 0.15), 0 2px 0 rgba(0,0,0,0.08);
}

[data-theme="light"] .back-btn {
  border-color: rgba(60, 40, 50, 0.15);
  background: rgba(60, 40, 50, 0.05);
  color: rgba(60, 40, 50, 0.5);
}

[data-theme="light"] .back-btn:active {
  background: rgba(60, 40, 50, 0.12);
}

[data-theme="light"] .mode-btn {
  border-color: rgba(180, 60, 70, 0.2);
  background: rgba(180, 60, 70, 0.06);
  color: #2A1F2D;
}

[data-theme="light"] .mode-btn:active {
  background: rgba(180, 60, 70, 0.15);
  border-color: rgba(180, 60, 70, 0.5);
}

[data-theme="light"] .mode-btn-accent {
  border-color: rgba(232, 72, 85, 0.25);
  background: rgba(232, 72, 85, 0.06);
}

[data-theme="light"] .mode-btn-accent:active {
  background: rgba(232, 72, 85, 0.15);
  border-color: rgba(232, 72, 85, 0.5);
}

[data-theme="light"] .mode-name { color: #2A1F2D; }
[data-theme="light"] .mode-btn-accent .mode-name { color: #D03040; }
[data-theme="light"] .mode-desc { color: rgba(60, 40, 50, 0.5); }
[data-theme="light"] .mode-high { color: rgba(180, 60, 70, 0.5); }
[data-theme="light"] .mode-btn-accent .mode-high { color: rgba(232, 72, 85, 0.45); }

[data-theme="light"] .score-row,
[data-theme="light"] .setting-row {
  border-color: rgba(180, 60, 70, 0.12);
  background: rgba(180, 60, 70, 0.04);
}

[data-theme="light"] .score-label,
[data-theme="light"] .setting-label { color: rgba(60, 40, 50, 0.65); }
[data-theme="light"] .score-value { color: #D03040; text-shadow: none; }

[data-theme="light"] .toggle-btn {
  border-color: rgba(180, 60, 70, 0.3);
  background: rgba(180, 60, 70, 0.1);
  color: #2A1F2D;
}

[data-theme="light"] .toggle-btn.off {
  border-color: rgba(60, 40, 50, 0.12);
  background: rgba(60, 40, 50, 0.04);
  color: rgba(60, 40, 50, 0.3);
}

[data-theme="light"] .about-name { color: #2A1F2D; }
[data-theme="light"] .about-version { color: rgba(60, 40, 50, 0.35); }
[data-theme="light"] .about-studio { color: rgba(180, 60, 70, 0.75); }
[data-theme="light"] .about-desc { color: rgba(60, 40, 50, 0.45); }
[data-theme="light"] .about-links a { color: rgba(180, 60, 70, 0.75); }

[data-theme="light"] .gameover-title {
  color: #2A1F2D;
  text-shadow: 0 0 20px rgba(180, 60, 70, 0.15), 0 2px 0 rgba(0,0,0,0.08);
}

[data-theme="light"] .final-score {
  color: #D03040;
  text-shadow: 0 0 20px rgba(180, 60, 70, 0.15), 0 3px 0 rgba(0,0,0,0.08);
}

[data-theme="light"] .final-detail { color: rgba(60, 40, 50, 0.5); }
[data-theme="light"] .high-score { color: rgba(180, 60, 70, 0.6); }
[data-theme="light"] .new-record { color: #D03040; }

[data-theme="light"] .lb-btn {
  border-color: rgba(180, 60, 70, 0.3);
  background: rgba(180, 60, 70, 0.08);
  color: rgba(60, 40, 50, 0.8);
}

[data-theme="light"] #level-display { color: rgba(180, 60, 70, 0.7); }
[data-theme="light"] #lines-display { color: rgba(60, 40, 50, 0.4); }
[data-theme="light"] #score-display {
  color: #2A1F2D;
  text-shadow: 0 0 10px rgba(180, 60, 70, 0.15);
}
[data-theme="light"] #combo-display { color: #D03040; }
