:root {
  --bg-top: #edf7ef;
  --bg-bottom: #edf7ef;
  --card: #ffffff;
  --ink: #173324;
  --accent: #2f8f57;
  --accent-deep: #267247;
  --mint: #3a9b61;
  --sky: #2f8f57;
  --warning: #e7b95a;
  --bad: #ff7d7d;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg-top);
  overflow-x: auto;
}

.shape {
  display: none;
}

.shape-a {
  width: 220px;
  height: 220px;
  top: -50px;
  left: -30px;
  background: radial-gradient(circle at 30% 30%, #ddf4e2, #8ccf9f);
}

.shape-b {
  width: 300px;
  height: 300px;
  right: -90px;
  top: 32%;
  background: radial-gradient(circle at 50% 40%, #d8f3df, #7fbe95);
  animation-delay: 1.2s;
}

.shape-c {
  width: 180px;
  height: 180px;
  left: 24%;
  bottom: -70px;
  background: radial-gradient(circle at 50% 40%, #dbf4e1, #74b98c);
  animation-delay: 2s;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 92vw);
  margin: 20px auto 36px;
}

.hero {
  text-align: center;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.3px;
}

.hero p {
  margin-top: 6px;
  font-size: 1.08rem;
}

.cloud-status {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #c9dfcf;
  background: #f3faf4;
  font-size: 0.96rem;
}

.cloud-status.success {
  border-color: #b8d8c0;
  background: #edf8f0;
}

.cloud-status.warning {
  border-color: #e1d6aa;
  background: #faf6e7;
}

.cloud-status.error {
  border-color: #e0bcbc;
  background: #fbefef;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #c9dfcf;
  box-shadow: none;
  padding: 18px;
}

h2,
h3,
p {
  margin-top: 0;
}

.field {
  display: block;
  margin: 10px 0 6px;
  font-weight: 700;
}

input[type="text"] {
  width: 100%;
  border: 2px solid #c1dbc8;
  border-radius: 14px;
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
}

input[type="number"] {
  width: 100%;
  border: 2px solid #c1dbc8;
  border-radius: 14px;
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
}

input[type="text"]:focus,
input[type="number"]:focus,
button:focus-visible {
  outline: 3px solid #6cbf87;
  outline-offset: 2px;
}

.image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-option {
  width: 72px;
  border: 2px solid #d2e5d7;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.image-option.selected {
  border-color: var(--accent);
}

.image-option img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  display: block;
}

button {
  font-family: inherit;
  border: 0;
}

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

.primary {
  margin-top: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 1.03rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.14s ease;
}

.primary.secondary {
  background: #3c9f67;
}

.primary.big {
  width: 100%;
  font-size: 1.2rem;
  padding: 14px;
}

.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid #c1dbc8;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.message {
  min-height: 22px;
  margin-top: 10px;
  font-weight: 700;
}

.message.error {
  color: #bf3232;
}

.message.success {
  color: #1e8f58;
}

.hidden {
  display: none !important;
}

.dashboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.stat-card {
  background: #f5fbf6;
  border: 1px solid #d1e4d5;
  border-radius: 10px;
  padding: 10px;
}

.stat-card span {
  display: block;
  font-size: 0.93rem;
}

.stat-card strong {
  font-size: 1.3rem;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.preset-btn {
  border: 1px solid #c1dbc8;
  background: #ffffff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.preset-btn.active {
  background: #2f8f57;
  color: #ffffff;
  border-color: #2f8f57;
}

.range-value {
  margin-top: 6px;
  font-size: 1.04rem;
}

.result-card {
  margin-top: 14px;
  border-radius: 10px;
  padding: 14px;
  border: 1px solid #c9dfcf;
  background: #f3faf4;
}

.play-panel {
  text-align: center;
}

.play-head {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.timer-wrap {
  margin-top: 6px;
}

.timer-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #d9e9de;
  overflow: hidden;
}

#timerFill {
  width: 100%;
  height: 100%;
  background: var(--sky);
  transition: width 0.1s linear, background-color 0.2s ease;
}

#timerLabel {
  margin: 6px 0 0;
  font-weight: 700;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: 1.2rem;
}

.question-text {
  margin: 16px 0;
  font-size: clamp(3.6rem, 14vw, 6.6rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}

.answer-btn {
  padding: 14px;
  border-radius: 10px;
  font-size: 2.1rem;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid #c1dbc8;
  background: #fff;
  transition: border-color 0.14s ease;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

.answer-btn.correct {
  border-color: #3a9b61;
  background: #e8f6ed;
}

.answer-btn.wrong {
  border-color: #d66f6f;
  background: #fdeeee;
}

.answer-btn:disabled {
  cursor: default;
}

.round-hint {
  margin-top: 12px;
  min-height: 24px;
  font-size: 1.02rem;
  font-weight: 700;
}

.round-hint.warning {
  color: #ac4d1a;
}

.round-hint.good {
  color: #267247;
}

.stat-card strong,
#progressText,
#maxNumberValue {
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-weight: 800;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(96vw, 980px);
    margin-top: 12px;
  }

  .panel {
    padding: 14px;
  }

  .play-head {
    flex-direction: column;
  }

  .image-option {
    width: 62px;
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }
}
