/* Love Colors — game-ui.css
 * In-game HUD, palette/tools panel, drawing stage, and dialogs.
 */

#screen-game {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}

/* ---------------- HUD ---------------- */

.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: linear-gradient(180deg, rgba(20, 10, 42, 0.55), rgba(20, 10, 42, 0));
  z-index: 10;
}

.hud-heading { display: flex; flex-direction: column; min-width: 0; }

.hud-title {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: clamp(13px, 2.4vw, 18px);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-cat { color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }

.hud-progress {
  flex: 1;
  min-width: 90px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
  min-width: 60px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--violet), var(--cyan));
  transition: width 0.18s ease;
}

.progress-text { font-weight: 800; font-size: 13px; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.hud-stars { display: flex; gap: 2px; }
.hud-stars .star { --sw: 22px; }

.hud-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-size: 14px;
}

.hud-timer {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line-strong);
  letter-spacing: 0.05em;
}

.hud-timer.warning {
  color: #fff;
  background: rgba(255, 89, 100, 0.45);
  border-color: var(--danger);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

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

/* ---------------- game main layout ---------------- */

.game-main {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 12px;
  padding: 6px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

body[data-layout="desktop"] .game-main {
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-rows: 1fr;
  grid-template-areas: "stage panel";
}

body[data-layout="mobile"] .game-main {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "stage" "panel";
}

/* ---------------- art stage ---------------- */

.art-stage {
  grid-area: stage;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background:
    radial-gradient(600px 400px at 50% 20%, rgba(255, 255, 255, 0.06), transparent 70%),
    rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
  overflow: hidden;
}

#stageCanvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.shake {
  animation: stageshake 0.5s ease;
}

@keyframes stageshake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 4px); }
  40% { transform: translate(6px, -5px); }
  60% { transform: translate(-5px, -3px); }
  80% { transform: translate(4px, 4px); }
}

/* ---------------- palette & tools panel ---------------- */

.palette-wrap {
  grid-area: panel;
  min-height: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.panel-inner { display: flex; flex-direction: column; gap: 14px; padding: 14px; }

.palette-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  align-content: flex-start;
}

.sw {
  --sw: #ff0000;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.55), transparent 40%),
    var(--sw);
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  touch-action: manipulation;
}

.sw:hover { transform: scale(1.08); }

.sw:active { transform: scale(0.94); }

.sw.active {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 16px rgba(255, 255, 255, 0.5);
  border-color: #fff;
}

.custom-color input[type="color"] {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
}

.custom-color input.active {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
  border-color: #fff;
}

.btn-rainbow {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  color: var(--gold);
}

/* tools */

.tool-row { display: flex; gap: 8px; }

.tool-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 8px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
}

.tool-btn:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }

.tool-btn:active { transform: scale(0.96); }

.tool-btn.active {
  border-color: var(--cyan);
  background: rgba(94, 234, 212, 0.14);
  color: var(--cyan);
  box-shadow: 0 0 14px rgba(94, 234, 212, 0.25);
}

/* brush slider */

.brush-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brush-label { font-size: 12px; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.brush-label span { color: var(--text); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  outline-offset: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--pink), var(--violet));
  border: 2px solid #fff;
  box-shadow: 0 0 12px rgba(255, 94, 156, 0.55);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--pink), var(--violet));
  border: 2px solid #fff;
  box-shadow: 0 0 12px rgba(255, 94, 156, 0.55);
  cursor: pointer;
}

/* actions */

.action-row { display: flex; flex-wrap: wrap; gap: 8px; }

.action-row .btn {
  flex: 1;
  min-width: 90px;
  min-height: 42px;
  padding: 9px 12px;
  font-size: 12px;
}

.action-row .btn span { letter-spacing: 0.09em; }

/* hint */

.hint {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
  border-left: 3px solid var(--pink);
  padding: 2px 0 2px 10px;
  font-style: italic;
}

/* ---------------- dialogs ---------------- */

.com-stars {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 6px 0 14px;
}

.com-stats {
  text-align: center;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.5;
}

.com-note {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
  margin-top: 10px;
}

.gameover-title { color: #ff9aa3; }
.victory-title {
  background: linear-gradient(120deg, #ffe88a, var(--pink), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* settings */

.settings-card { width: min(440px, 94vw); }

.setting-rows {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.setting-row:last-child { border-bottom: none; }

.setting-row em { color: var(--muted); font-style: normal; font-size: 12px; font-weight: 500; }

.setting-row input[type="range"] { max-width: 190px; }

.toggle {
  -webkit-appearance: none;
  appearance: none;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex: 0 0 auto;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle:checked { background: linear-gradient(120deg, var(--pink), var(--violet)); }
.toggle:checked::after { transform: translateX(24px); }

.toggle:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* how to play */

.howto-card { width: min(560px, 94vw); }
.howto-card .howto-scroll { max-height: 52vh; overflow-y: auto; }

.howto-scroll { display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }

.howto-sec {
  border-left: 3px solid var(--pink);
  padding: 4px 0 4px 14px;
}

.howto-sec h3 {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pink-soft);
  margin-bottom: 5px;
}

.howto-sec p { color: var(--text); font-size: 14px; line-height: 1.6; }

.controls-list { list-style: none; display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }

.controls-list li { color: var(--text); font-size: 13.5px; line-height: 1.5; }

kbd {
  display: inline-block;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
}