@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:          #fafaf9;
  --surface:     #ffffff;
  --border:      #e8e6e1;
  --border-soft: #f0ede8;
  --text:        #1a1917;
  --text-2:      #6b6860;
  --text-3:      #b0ada6;
  --amber:       #d97706;
  --amber-light: #fef3c7;
  --amber-mid:   #fbbf24;
  --green:       #16a34a;
  --red:         #dc2626;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:   0 20px 40px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.06);
  --r:           16px;
  --ease:        cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── NAV ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(250,250,249,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-soft);
}

.nav-logo {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-logo-mark {
  width: 22px; height: 22px;
  background: var(--text);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-logo-mark span {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--bg);
  letter-spacing: -0.03em;
}

.nav-right { display: flex; align-items: center; gap: 4px; }

.nav-link {
  font-size: 0.875rem;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--border-soft); color: var(--text); }
.nav-link.active { color: var(--text); }

.nav-btn {
  background: var(--text);
  border: none;
  color: var(--bg);
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}
.nav-btn:hover { opacity: 0.82; }
.nav-btn:active { transform: scale(0.97); }

/* ── MAIN ── */
.main {
  min-height: 100vh;
  padding: 60px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1080px;
  margin: 0 auto;
}

/* ── LEFT PANEL ── */
.rate-section {
  padding: 64px 48px 64px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 60px);
  border-right: 1px solid var(--border-soft);
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.headline {
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--text);
  margin-bottom: 40px;
}

/* ── LIVE COUNT ── */
.participants {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 12px 6px 8px;
  box-shadow: var(--shadow-sm);
  width: fit-content;
}

.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.3;
  animation: ripple 2s ease-out infinite;
}

@keyframes ripple {
  0%   { transform: scale(1); opacity: 0.3; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ── RATING DIAL ── */
.stars-wrap {
  margin-bottom: 24px;
}

.stars {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.star {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  user-select: none;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
}

.star:hover {
  border-color: var(--amber-mid);
  color: var(--amber);
  background: var(--amber-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.star.hovered {
  border-color: var(--amber-mid);
  color: var(--amber);
  background: var(--amber-light);
  transform: translateY(-2px);
}

.star.selected {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-md);
}

.star.locked { cursor: default; }
.star.locked:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}
.star.locked.selected {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  transform: none;
}

.stars-hint {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 400;
}

/* ── SUBMIT ── */
.confirm-btn {
  width: 100%;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--r);
  padding: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: var(--shadow-md);
}
.confirm-btn:disabled {
  background: var(--border);
  color: var(--text-3);
  cursor: not-allowed;
  box-shadow: none;
}
.confirm-btn:not(:disabled):hover  { opacity: 0.85; }
.confirm-btn:not(:disabled):active { transform: scale(0.99); }

/* ── WORD PROMPT ── */
.word-prompt {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: popIn 0.35s var(--ease) forwards;
}

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

.word-label {
  padding: 14px 16px 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
}
.optional { color: var(--text-3); font-weight: 400; }

.word-input-row {
  display: flex;
  border-top: 1px solid var(--border-soft);
}

.word-input-row input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  padding: 12px 16px;
  outline: none;
}
.word-input-row input::placeholder { color: var(--text-3); }

.word-submit-btn {
  background: none;
  border: none;
  border-left: 1px solid var(--border-soft);
  color: var(--amber);
  font-size: 1.1rem;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.word-submit-btn:hover { background: var(--amber-light); }

/* ── ALREADY RATED ── */
.already-rated {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 0.875rem;
  color: var(--text-2);
  font-weight: 500;
}

/* ── RIGHT PANEL ── */
.teaser-section,
.result-section {
  padding: 64px 40px 64px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 60px);
}

.teaser-section {
  align-items: center;
  justify-content: center;
}

.teaser-inner {
  text-align: center;
  width: 100%;
}

.teaser-number {
  font-size: 9rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  color: var(--border);
  margin-bottom: 16px;
  user-select: none;
}

.teaser-label {
  font-size: 0.875rem;
  color: var(--text-3);
  font-weight: 500;
}

/* ── RESULT ── */
.result-section { animation: fadeSlide 0.5s var(--ease-out) forwards; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.result-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.global-score {
  font-size: clamp(5rem, 10vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 6px;
  transition: all 0.6s var(--ease-out);
}

.global-stars {
  display: flex;
  gap: 3px;
  margin-bottom: 6px;
}

.global-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 28px;
}

.comparison {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.6;
  padding: 16px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 28px;
}
.comparison strong { color: var(--text); font-weight: 600; }
.above { color: var(--green); }
.below { color: var(--red); }

/* ── WORD CLOUD ── */
.wordcloud-wrap { margin-bottom: 28px; }

.wordcloud-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.wordcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.wc-word {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px;
  color: var(--text-2);
  font-weight: 500;
  cursor: default;
  transition: all 0.15s;
  animation: wordPop 0.4s var(--ease) backwards;
}

@keyframes wordPop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.wc-word:hover {
  background: var(--amber-light);
  border-color: var(--amber-mid);
  color: var(--amber);
}

/* ── SHARE ── */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 12px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.share-btn:hover {
  border-color: var(--text);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── HISTORY ── */
.history-main {
  padding: 80px 40px 60px;
  max-width: 760px;
  margin: 0 auto;
}

.history-header { margin-bottom: 40px; }

.history-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.history-card {
  display: flex;
  align-items: center;
  background: var(--surface);
  padding: 16px 20px;
  gap: 16px;
  transition: background 0.15s;
}
.history-card:hover { background: var(--bg); }

.history-date {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

.history-score {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  min-width: 52px;
  text-align: right;
}

.history-count {
  font-size: 0.8125rem;
  color: var(--text-3);
  font-weight: 400;
  min-width: 80px;
  text-align: right;
}

.history-word {
  font-size: 0.8125rem;
  color: var(--text-3);
  font-style: italic;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,25,23,0.5);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s var(--ease) forwards;
}

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

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 28px;
  line-height: 1.6;
}

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: border-color 0.15s, background 0.15s;
  letter-spacing: -0.01em;
}
.google-btn:hover { border-color: var(--text-2); background: var(--border-soft); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--text-3);
  font-size: 0.8125rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.form-group { margin-bottom: 8px; }

.form-group input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--text); }
.form-group input::placeholder { color: var(--text-3); }

.email-btn {
  width: 100%;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
  transition: opacity 0.15s;
}
.email-btn:hover { opacity: 0.85; }

.modal-toggle {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-2);
}
.modal-toggle a { color: var(--text); font-weight: 600; text-decoration: none; }
.modal-toggle a:hover { text-decoration: underline; }

@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* ── RESPONSIVE ── */
@media (max-width: 760px) {
  .main {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
  }

  .rate-section {
    min-height: auto;
    padding: 40px 20px 32px;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    justify-content: flex-start;
  }

  .teaser-section { display: none; }

  .result-section {
    min-height: auto;
    padding: 32px 20px 48px;
    justify-content: flex-start;
  }

  .teaser-number { font-size: 6rem; }
  .history-main { padding: 76px 16px 40px; }
  .history-card { padding: 14px 16px; }
  .history-count { display: none; }
}