:root {
  --ga-color: #333333;
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e5e5e5;
  --error: #c0392b;
  --success: #1e7c3a;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, 'Apple SD Gothic Neo', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

/* ---------- Hero / prompt ---------- */
.hero {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.prompt {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 8px 0 20px;
  color: var(--ga-color);
}
.prompt .blank {
  display: inline-block;
  min-width: 3em;
  border-bottom: 3px solid var(--ga-color);
  margin: 0 4px;
}
.prompt .suffix { color: var(--text); }

/* ---------- Toggles ---------- */
.toggle {
  display: inline-flex;
  border: 1px solid var(--ga-color);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}
.toggle-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ga-color);
  font: inherit;
  font-weight: 600;
  padding: 8px 22px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.toggle-btn.is-active {
  background: var(--ga-color);
  color: #fff;
}

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 10px; }
.word-input,
.reason-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px; /* ≥16px prevents iOS zoom */
  background: #fafafa;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.word-input:focus,
.reason-input:focus {
  outline: none;
  border-color: var(--ga-color);
  background: #fff;
}
.word-input {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.05em;
}
.reason-input {
  resize: none;
  font-size: 15px;
}
.submit-btn {
  appearance: none;
  border: 0;
  background: var(--ga-color);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
  min-height: 48px;
}
.submit-btn:hover { opacity: 0.92; }
.submit-btn:active { transform: translateY(1px); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-message {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.form-message--error   { color: var(--error); background: #fdecea; }
.form-message--success { color: var(--success); background: #e7f6ec; }

/* ---------- Cloud ---------- */
.cloud-section {
  text-align: center;
  margin-bottom: 28px;
}
.cloud-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 12px;
}
.cloud-title #participant-count {
  color: var(--ga-color);
  font-weight: 700;
}
.cloud-tabs {
  display: inline-flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.cloud-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 8px 24px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.cloud-tab.is-active {
  color: var(--ga-color);
  border-bottom-color: var(--ga-color);
}

.cloud-canvas-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 380px;
}
#wordcloud-canvas {
  max-width: 100%;
  height: auto;
}
.cloud-empty {
  position: absolute;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Recent ---------- */
.recent-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
}
.recent-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 12px;
}
.recent-card {
  background: #f8f8fa;
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  animation: fade-in 0.4s ease;
}
.recent-headline {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ga-color);
}
.recent-reason {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 380px) {
  .page { padding: 20px 16px 28px; }
  .prompt { font-size: 24px; }
  .word-input { font-size: 28px; }
  .toggle-btn { padding: 8px 18px; }
}
