:root {
  --bg: #1c2026;
  --panel: #26334a;
  --panel-dark: #1f2936;
  --button: #1f3d66;
  --button-hover: #2b4f83;
  --text: #e7eef9;
  --muted: #9aa8bf;
  --green: #2f6b45;
  --red: #7a3a35;
  --gray: #3a3f46;
  --outline: #10151c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top, #24314a 0%, #1a1f26 45%, #15191e 100%);
  color: var(--text);
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: #22324b;
  border-bottom: 1px solid #111826;
  letter-spacing: 0.5px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  color: #c9d7ef;
}

.disabled-text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #b8c7de;
  margin-left: 8px;
  text-transform: none;
}

.round {
  font-size: 15px;
  color: var(--muted);
}

.content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 12px 14px 20px;
}

.quiz-view {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.cube-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  background: var(--panel-dark);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px #10151c, 0 10px 30px rgba(0, 0, 0, 0.35);
}

#cubeCanvas {
  width: min(72vw, 360px);
  height: auto;
}

.review-panel {
  background: #2a3240;
  border: 1px solid #111826;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.start-panel {
  display: flex;
  justify-content: center;
}

.review-title {
  font-size: 16px;
  letter-spacing: 0.5px;
  color: #f3b3ad;
}

.review-line {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
}

.review-label {
  color: var(--muted);
}

.review-value {
  font-weight: 600;
  color: #e6edf9;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.pll-button {
  background: var(--button);
  color: #eef4ff;
  border: none;
  border-radius: 14px;
  padding: 12px 0;
  font-size: clamp(15px, 4.2vw, 20px);
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 1px #0c1422;
  transition: transform 0.08s ease, background 0.2s ease;
}

.pll-button:active {
  transform: translateY(1px);
}

.pll-button:hover {
  background: var(--button-hover);
}

.pll-button.correct-hint {
  background: var(--green);
}

.pll-button.wrong-hint {
  background: var(--red);
}

.pll-button.off {
  background: #2b333f;
  color: #8a98b1;
  box-shadow: inset 0 0 0 1px #141a22;
}

.button-grid.disabled .pll-button {
  opacity: 0.45;
  pointer-events: none;
}

.primary {
  background: #35558d;
  color: #f1f6ff;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 15px;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #0c1422;
}

.primary:hover {
  background: #3f6aa9;
}

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #2c3c55;
}

.results-view {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.results-header {
  background: #24314a;
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}

.results-stat span {
  font-weight: 700;
  margin-left: 6px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.result-tile {
  background: #293445;
  border-radius: 12px;
  padding: 8px;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid #111826;
}

.result-tile.correct {
  background: #2f5c3c;
}

.result-tile.wrong {
  background: #5a2d2d;
}

.result-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-pll {
  font-size: 16px;
  font-weight: 700;
}

.result-time {
  color: #e0e7f5;
  font-size: 14px;
}

.results-actions {
  display: flex;
  justify-content: center;
  padding-bottom: 12px;
}

.hidden {
  display: none;
}

@media (min-width: 720px) {
  .button-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  #cubeCanvas {
    width: min(320px, 50vw);
  }
}

@media (max-width: 380px) {
  .pll-button {
    font-size: 13px;
    padding: 8px 0;
    border-radius: 12px;
  }
}

@media (max-width: 520px) {
  .button-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 8px;
  }

  .pll-button {
    width: 100%;
    height: 100%;
    padding: 0;
    font-size: clamp(14px, 4.2vw, 18px);
  }

  .start-panel .primary {
    padding: 12px 22px;
    font-size: 15px;
  }
}
