:root {
  --bg-a: #fff8da;
  --bg-b: #d9f6ff;
  --bg-c: #ffe5f1;
  --panel: #ffffffee;
  --text: #16233a;
  --muted: #3f5068;
  --primary: #1b98e0;
  --primary-strong: #0c7cc0;
  --accent: #ffb703;
  --accent-strong: #f18f01;
  --danger: #d62828;
  --ok: #2a9d8f;
  --soft-border: #c2d8eb;
  --shadow: 0 10px 24px rgba(33, 53, 71, 0.12);
  --radius: 20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 12%, #fff4be 0%, transparent 38%),
    radial-gradient(circle at 88% 8%, #d7f5ff 0%, transparent 35%),
    radial-gradient(circle at 50% 90%, #ffe2ef 0%, transparent 42%),
    linear-gradient(140deg, var(--bg-a), var(--bg-b) 55%, var(--bg-c));
}

#app { max-width: 1024px; margin: 0 auto; padding: 16px 16px 22px; }

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid #eef4fa;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 12px;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: radial-gradient(circle, #ffffff66 0%, #ffffff00 70%);
  pointer-events: none;
}

.hero-card::before {
  content: "";
  position: absolute;
  left: -16px;
  bottom: -22px;
  width: 120px;
  height: 80px;
  background: radial-gradient(circle, #ffe59a 0%, #ffe59a00 70%);
}

.language-corner {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
}

.flag-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border-radius: 999px;
  border: 2px solid #c7def0;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flag-btn.flag-active {
  border-color: #1b98e0;
  box-shadow: 0 0 0 2px #bfe5fb;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(30px, 4.4vw, 42px); letter-spacing: 0.1px; line-height: 1.15; }
h2 { font-size: clamp(24px, 3.3vw, 32px); line-height: 1.2; }
h3 { font-size: clamp(18px, 2.4vw, 23px); line-height: 1.25; }

.subtitle { color: var(--muted); margin-top: 4px; font-size: clamp(15px, 2.2vw, 19px); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

button, select, input {
  border: 0;
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 17px;
  font-family: inherit;
}

input, select {
  background: #ffffff;
  border: 2px solid var(--soft-border);
  color: var(--text);
  width: 100%;
  font-weight: 600;
}

input:focus, select:focus, button:focus { outline: 3px solid #78c3f5; outline-offset: 1px; }

button {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transform: translateY(0);
  transition: transform 0.12s ease, filter 0.12s ease;
}

button:active { transform: translateY(1px) scale(0.995); }
button:hover { filter: brightness(1.05); }
button.secondary { background: linear-gradient(180deg, #eff7ff, #dbefff); color: var(--text); }
button.warn { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); color: #1b1b1b; }
button:disabled { opacity: 0.65; cursor: not-allowed; }

.auth-grid, .modes { display: grid; grid-template-columns: 1fr; gap: 12px; }
.mode-btn { text-align: left; min-height: 90px; border: 2px solid #ffffff; }

.small { font-size: 14px; color: var(--muted); line-height: 1.35; }

.alert {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #ffe8ea;
  border: 2px solid #ffd1d8;
  color: #7a1d2a;
  font-size: 14px;
  font-weight: 700;
}

.score { font-size: clamp(30px, 6vw, 42px); font-weight: 800; }
.question { text-align: center; font-size: clamp(22px, 3.2vw, 32px); margin-bottom: 10px; font-weight: 700; }
.canvas-wrap { display: flex; justify-content: center; margin: 10px 0 14px; }

#analogClockMain {
  width: min(72vw, 300px);
  height: min(72vw, 300px);
  background: #fff;
  border-radius: 50%;
  border: 10px solid #d9ecfa;
}

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { min-height: 86px; }
.analog-choice { background: #fff; padding: 8px; }
.analog-choice canvas { width: 108px; height: 108px; }
.feedback { min-height: 24px; font-size: 18px; font-weight: 800; }
.ok { color: var(--ok); }
.bad { color: var(--danger); }

.tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.tab-btn { min-height: 56px; }

.sayings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.say-card {
  background: #fff;
  border: 2px solid #e7f3fb;
  border-radius: 14px;
  padding: 12px;
  font-weight: 800;
  text-align: center;
}

.donate-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff7de;
  border: 2px solid #ffd166;
  color: #5f4200;
  font-weight: 700;
  text-decoration: none;
}

.donate-link:hover {
  background: #ffefbf;
}

.doodle-canvas {
  width: 100%;
  height: 220px;
  border-radius: 14px;
  border: 2px dashed #9fd6f7;
  touch-action: none;
  margin-top: 10px;
  background: #fff;
}

.leaderboard-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  background: #fff;
  padding: 12px;
  border-radius: 14px;
  border: 2px solid #e5f0f9;
  font-size: 18px;
}

.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e6f5ff;
  border: 1px solid #b8e2ff;
}

@media (min-width: 800px) {
  .auth-grid, .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
