@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;700&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #111111;
  --panel-border: #222222;
  --text: #eeebe6;
  --muted: #555555;
  --primary: #6b8aff;
  --field-bg: #111111;
  --field-border: #222222;
  --hotspot-bg: #111111;
  --hotspot-border: #222222;
  --dot: #777777;
}

* {
  box-sizing: border-box;
}

body,
body.light-theme {
  margin: 0;
  font-family: "Space Grotesk", "Inter", "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}

.page {
  max-width: 780px;
  margin: 2.2rem auto;
  padding: 0 1rem 2rem;
  width: min(100%, 780px);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

h1,
h2,
h3,
.condensed,
.scale-output,
.result-percent {
  margin-top: 0;
  font-family: "Barlow Condensed", "Space Grotesk", sans-serif;
  letter-spacing: 0.01em;
}

h1 {
  margin-bottom: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 500;
  margin: 0.65rem 0 0.4rem;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  padding: 0.58rem 0.72rem;
  font-size: 1rem;
}

input,
select,
textarea {
  background: var(--field-bg);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus,
button:focus,
.scale-visualizer:focus-visible {
  outline: 1px solid var(--primary);
  outline-offset: 1px;
}

button {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  background: var(--primary);
  color: #0a0a0a;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button.danger {
  border-color: #a66;
  color: #d38686;
}

button.danger:hover {
  background: #a66;
  color: #0a0a0a;
}

.inline {
  display: flex;
  gap: 0.55rem;
}

.gap {
  gap: 0.55rem;
}

.stack {
  display: grid;
  gap: 0.55rem;
}

.hidden {
  display: none;
}

.quiz-option {
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
}

.quiz-option.selected {
  box-shadow: 0 0 0 1px #6b8aff, 0 0 12px rgba(107, 138, 255, 0.15);
}

.scale-vote {
  display: grid;
  justify-items: center;
  gap: 1rem;
}

.scale-control {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
}

.scale-range {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.scale-visualizer {
  width: 40px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
}

.scale-track {
  position: relative;
  width: 2px;
  height: 100%;
  background: #222222;
}

.scale-fill {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 2px;
  height: 50%;
  color: #ffaa00;
  background: currentColor;
  box-shadow: 0 0 8px currentColor, 0 0 24px color-mix(in srgb, currentColor 40%, transparent);
}

.scale-handle {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 6px;
  border-radius: 3px;
  background: currentColor;
  box-shadow: 0 0 8px currentColor, 0 0 24px color-mix(in srgb, currentColor 40%, transparent);
}

.scale-max,
.scale-min {
  font-weight: 700;
  color: var(--muted);
}

.scale-output {
  min-width: 3.25rem;
  text-align: center;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
}

.scale-label {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.hotspot {
  position: relative;
  min-height: 280px;
  border: 1px dashed var(--hotspot-border);
  border-radius: 10px;
  background: var(--hotspot-bg);
}

.dot,
.fire {
  position: absolute;
  transform: translate(-50%, -50%);
}

.dot {
  width: 13px;
  height: 13px;
  border-radius: 100%;
  background: var(--dot);
  border: 1px solid #333;
  padding: 0;
}

.dot.mine {
  background: var(--primary);
}

.fire {
  font-size: 1.6rem;
}

.timeline-vote,
.timeline-result {
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
}

.timeline-beam {
  position: absolute;
  left: 2%;
  right: 2%;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, #4b5cff, #8f5cff, #ff5ca8, #ff8a3d);
  box-shadow: 0 0 14px rgba(143, 92, 255, 0.45);
}

.timeline-dot,
.timeline-hotspot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 100%;
  border: 1px solid #4d4d4d;
  background: var(--dot);
  padding: 0;
}

.timeline-dot.mine {
  background: var(--primary);
}

.timeline-hotspot {
  font-size: calc(1.1rem + (var(--timeline-strength, 0.5) * 0.8rem));
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255, 140, 20, 0.65));
}

.balance-vote {
  display: grid;
  gap: 0.9rem;
}

.puzzle-vote {
  display: grid;
  gap: 0.9rem;
}

.puzzle-stage {
  --puzzle-image-url: none;
  --puzzle-cols: 30;
  --puzzle-rows: 20;
  display: grid;
  grid-template-columns: repeat(var(--puzzle-cols), minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  aspect-ratio: calc(var(--puzzle-cols) / var(--puzzle-rows));
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  background: #090909;
}

.puzzle-stage-button {
  padding: 0;
  cursor: pointer;
}

.puzzle-stage-button:disabled {
  cursor: not-allowed;
}

.puzzle-tile {
  appearance: none;
  border-radius: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid #1f1f1f;
  background: #0f0f0f;
  cursor: pointer;
}

.puzzle-tile:disabled {
  cursor: not-allowed;
}

.puzzle-tile.filled {
  background-image: var(--puzzle-image-url);
  background-size: calc(var(--puzzle-cols) * 100%) calc(var(--puzzle-rows) * 100%);
  border-color: #333;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.puzzle-tile.filled:disabled {
  opacity: 1;
}

.puzzle-result {
  display: grid;
  gap: 0.8rem;
}

.puzzle-final-image {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.balance-stage {
  position: relative;
  min-height: 170px;
  display: grid;
  place-items: center;
}

.balance-pivot {
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-bottom: 42px solid #2a2a2a;
  transform: translateY(52px);
}

.balance-beam {
  width: min(100%, 460px);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  transform-origin: center center;
  border-top: 4px solid var(--primary);
  padding-top: 0.8rem;
  transition: transform 0.35s ease;
}

.balance-pan {
  width: 44%;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #141414;
  padding: 0.75rem;
  text-align: center;
}

.balance-option {
  display: block;
  font-weight: 700;
}

.balance-count {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.4rem;
  color: var(--primary);
  font-family: "Barlow Condensed", "Space Grotesk", sans-serif;
}

#vote-ui,
#result {
  margin-top: 0.9rem;
}

#vote-ui > div,
#result {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
}

.result-quiz {
  display: grid;
  gap: 0.75rem;
}

.result-item {
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 0.8rem;
}

.result-title {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.result-percent {
  font-size: 48px;
  font-weight: 700;
  line-height: 0.9;
  margin-bottom: 0.35rem;
}

.result-count {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.result-progress {
  width: 100%;
  height: 4px;
  border-radius: 0;
  background: #1b1b1b;
  overflow: hidden;
}

.result-progress-fill {
  height: 100%;
  background: var(--primary);
}

.badge,
.pill {
  display: inline-block;
  border: 1px solid #333;
  border-radius: 2px;
  padding: 0.15rem 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.avatar,
.participant-avatar {
  border: 1px solid #333;
}

.tab,
[role="tab"] {
  border: 1px solid transparent;
}

.tab.active::before,
[role="tab"][aria-selected="true"]::before {
  content: "■ ";
  color: var(--primary);
}

input[type="radio"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #111;
  display: inline-grid;
  place-content: center;
}

input[type="radio"]::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: scale(0);
  transition: transform 0.1s ease-in-out;
  border-radius: 2px;
  background: var(--primary);
}

input[type="radio"]:checked::before {
  transform: scale(1);
}

pre {
  margin: 0;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .inline {
    flex-direction: column;
  }

  .page {
    margin-top: 1.1rem;
    padding: 0 0.8rem 1.6rem;
  }

  .page-header {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
  }

  h1 {
    font-size: 1.9rem;
  }

  button,
  input,
  select,
  textarea {
    min-height: 46px;
  }

  .hotspot {
    min-height: 230px;
  }

  .balance-stage {
    min-height: 160px;
  }
}
