/* styles.css — HUD overlay for the 3D Tower of Hanoi. The Babylon canvas
   fills the viewport; everything here floats on top of it. */

:root {
  --glass: rgba(18, 22, 40, 0.55);
  --glass-strong: rgba(14, 18, 34, 0.82);
  --stroke: rgba(255, 255, 255, 0.12);
  --accent: #ffd54a;
  --accent2: #4da6ff;
  --text: #eef1fb;
  --muted: #9aa3c4;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05060f;
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#renderCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > * { pointer-events: auto; }

/* ---- Top bar -------------------------------------------------------- */
#top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.brand .title { font-size: 19px; }
.brand .sub { font-size: 12px; color: var(--muted); font-weight: 500; }

.stats {
  display: flex;
  gap: 10px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
}
.stat { text-align: center; min-width: 62px; }
.stat .label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 12px; color: var(--muted); font-weight: 600; }

.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.12s ease, background 0.2s ease;
}
.icon-btn:hover { background: rgba(40, 48, 80, 0.7); transform: translateY(-1px); }

/* ---- Status line ---------------------------------------------------- */
#status-msg {
  position: absolute;
  top: 78px; left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--stroke);
  padding: 6px 16px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Bottom control dock ------------------------------------------- */
#bottom-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: center;
  padding: 16px;
}
.dock {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.disk-picker { display: flex; align-items: center; gap: 10px; }
.disk-picker label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.disk-picker .count {
  font-weight: 700; font-size: 16px; min-width: 18px; text-align: center;
  color: var(--accent);
}
input[type='range'] {
  -webkit-appearance: none; appearance: none;
  width: 120px; height: 5px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  outline: none; cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
input[type='range']::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); cursor: pointer;
}

.divider { width: 1px; height: 30px; background: var(--stroke); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px;
  font-size: 14px; font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(40, 48, 80, 0.55);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s ease;
}
.btn:hover:not(:disabled) { background: rgba(60, 72, 120, 0.8); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent2), #2d7dff);
  border-color: transparent; color: #08122b;
  font-weight: 700;
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }

/* ---- Help panel ----------------------------------------------------- */
#help-panel {
  position: absolute;
  top: 64px; right: 18px;
  width: 290px; max-width: 88vw;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#help-panel.open { opacity: 1; transform: none; pointer-events: auto; }
#help-panel h3 { margin: 0 0 8px; font-size: 15px; }
#help-panel ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; color: #d6dbf0; }
#help-panel .goal { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ---- Win modal ------------------------------------------------------ */
#win-modal {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: rgba(4, 6, 16, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 20;
}
#win-modal.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 360px; max-width: 90vw;
  background: linear-gradient(160deg, rgba(28,34,62,0.96), rgba(14,18,34,0.96));
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 28px 26px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  transform: scale(0.92);
  transition: transform 0.3s cubic-bezier(0.18, 0.9, 0.3, 1.2);
}
#win-modal.open .modal-card { transform: scale(1); }
.modal-card h2 { margin: 0 0 4px; font-size: 26px; }
.stars { font-size: 34px; color: var(--accent); letter-spacing: 4px; margin: 6px 0 14px; }
.win-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 20px;
}
.win-grid .cell {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--stroke);
  border-radius: 12px; padding: 10px 6px;
}
.win-grid .cell .k { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.win-grid .cell .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ---- Loading splash ------------------------------------------------- */
#loading {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background: #05060f;
  transition: opacity 0.5s ease;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 620px) {
  .brand .sub { display: none; }
  .stat { min-width: 50px; }
  .stat .value { font-size: 17px; }
  .dock { gap: 10px; padding: 10px 12px; }
  .btn { padding: 9px 12px; font-size: 13px; }
  input[type='range'] { width: 90px; }
  #status-msg { font-size: 12px; }
}
