:root {
  --ink: #101112;
  --ink-soft: #222428;
  --paper: #f5f0e8;
  --accent: #d9723d;
  --accent-2: #2a7b7b;
  --shadow: rgba(16, 17, 18, 0.12);
  --border: rgba(16, 17, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff5e5 0%, #f5f0e8 40%, #ebe2d5 100%);
  min-height: 100vh;
}

.ambient {
  position: fixed;
  inset: 0;
  background: linear-gradient(120deg, rgba(217, 114, 61, 0.18), rgba(42, 123, 123, 0.12));
  mix-blend-mode: multiply;
  pointer-events: none;
  animation: drift 12s ease-in-out infinite;
}

@keyframes drift {
  0% {
    opacity: 0.4;
    transform: translateY(0px);
  }

  50% {
    opacity: 0.7;
    transform: translateY(-12px);
  }

  100% {
    opacity: 0.4;
    transform: translateY(0px);
  }
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: grid;
  gap: 32px;
}

.shell--wide {
  max-width: 1100px;
}

.hero {
  padding: 28px 32px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 20px 60px var(--shadow);
  border: 1px solid var(--border);
  animation: rise 0.6s ease-out;
}

.hero--compact h1 {
  font-size: 40px;
}

.hero-bar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  background: #f2ece2;
  color: var(--ink);
}

.nav-link--active {
  background: var(--accent);
  color: #fff;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero h1 {
  font-family: "Shippori Mincho", serif;
  font-size: 48px;
  margin: 12px 0;
}

.hero p {
  max-width: 560px;
  margin: 0;
  color: var(--ink-soft);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 600;
}

.panel {
  background: #fff;
  border-radius: 20px;
  padding: 24px 28px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px var(--shadow);
  display: grid;
  gap: 16px;
  animation: rise 0.6s ease-out;
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 22px;
}

.hint {
  color: var(--ink-soft);
  font-size: 13px;
}

.capture-box {
  display: grid;
  gap: 12px;
}

.capture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

textarea {
  width: 100%;
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  resize: vertical;
}

/* Button class shared styles */
.btn,
button,
.primary,
.secondary {
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-block;
  text-decoration: none;
  font-size: 14px;
  /* Ensure consistency */
  line-height: normal;
}

button:hover,
.btn:hover,
.primary:hover,
.secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(16, 17, 18, 0.12);
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: #f2ece2;
  color: var(--ink);
}

.danger {
  background: #d95c4a;
  color: #fff;
}

.status {
  font-size: 13px;
  color: var(--accent-2);
}

.muted {
  font-size: 13px;
  color: var(--ink-soft);
}

.result {
  background: #fdfaf5;
  border-radius: 16px;
  padding: 16px;
  border: 1px dashed rgba(16, 17, 18, 0.16);
  display: grid;
  gap: 10px;
}

.result strong {
  font-size: 18px;
}

.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-list--stacked {
  flex-direction: column;
  align-items: flex-start;
}

.choice-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f2ece2;
  cursor: pointer;
}

.result ruby {
  ruby-position: over;
}

.result rt {
  font-size: 0.6em;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.review-actions {
  display: flex;
  gap: 12px;
}

.review-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.review-form .full {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.field label {
  font-weight: 600;
}

.field input,
.field select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: "Space Grotesk", sans-serif;
}

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

.checkbox--disabled {
  opacity: 0.6;
}

.checkbox--disabled input {
  cursor: not-allowed;
}

.candidate-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 17, 18, 0.08);
  color: var(--ink-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: linear-gradient(135deg, rgba(217, 114, 61, 0.08), rgba(42, 123, 123, 0.08));
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(16, 17, 18, 0.12);
  display: grid;
  gap: 8px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  font-weight: 600;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
}

.stat-detail {
  font-size: 13px;
  color: var(--ink-soft);
}

.heatmap {
  display: grid;
  gap: 16px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.heatmap-scale {
  display: flex;
  gap: 6px;
}

.heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 14px);
  gap: 6px;
}

.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #f2ece2;
  border: 1px solid rgba(16, 17, 18, 0.08);
}

.heatmap-cell[data-intensity="1"] {
  background: rgba(42, 123, 123, 0.25);
}

.heatmap-cell[data-intensity="2"] {
  background: rgba(42, 123, 123, 0.45);
}

.heatmap-cell[data-intensity="3"] {
  background: rgba(42, 123, 123, 0.65);
}

.heatmap-cell[data-intensity="4"] {
  background: rgba(42, 123, 123, 0.85);
}

.words-search {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.words-search input[type="search"] {
  flex: 1;
  min-width: 220px;
  border-radius: 999px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  font-family: "Space Grotesk", sans-serif;
}

.words-list {
  display: grid;
  gap: 22px;
}

.word-card {
  background: #fffaf3;
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(16, 17, 18, 0.12);
  display: grid;
  gap: 12px;
  box-shadow: 0 12px 30px rgba(16, 17, 18, 0.08);
}

.word-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.word-card__title {
  font-size: 20px;
  font-weight: 600;
}

.word-card__meta {
  display: grid;
  gap: 6px;
}

.word-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-card__notes {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(42, 123, 123, 0.08);
}

.word-card__notes-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: rgba(16, 17, 18, 0.6);
}

.word-card__notes-body {
  font-size: 14px;
  line-height: 1.5;
}

.word-card__qa {
  display: grid;
  gap: 8px;
}

.word-card__history {
  border-radius: 14px;
  padding: 8px 12px;
  background: rgba(16, 17, 18, 0.03);
  border: 1px solid rgba(16, 17, 18, 0.08);
}

.word-card__history summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.word-card__history-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.word-card__history-list {
  display: grid;
  gap: 10px;
}

.word-card__history-item {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(16, 17, 18, 0.08);
}

.word-card__qa-input {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-family: "Space Grotesk", sans-serif;
}

.word-card__qa-answer {
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(16, 17, 18, 0.04);
}

.word-card__qa-answer--hidden {
  display: none;
}

.stat-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(42, 123, 123, 0.12);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.stat-pill--alert {
  background: rgba(217, 114, 61, 0.2);
  color: var(--ink);
}

@media (max-width: 720px) {
  .hero h1 {
    font-size: 36px;
  }

  .panel {
    padding: 20px;
  }

  .hero--compact h1 {
    font-size: 32px;
  }

  .heatmap-grid {
    grid-template-rows: repeat(7, 12px);
    gap: 4px;
  }

  .heatmap-cell {
    width: 12px;
    height: 12px;
  }
}

.beta-popup {
  position: fixed;
  inset: 0;
  background: rgba(16, 17, 18, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease-out;
}

/* Ensure hidden attribute takes precedence over flex display */
.beta-popup[hidden] {
  display: none !important;
}

.beta-popup__content {
  background: #fff;
  padding: 24px;
  border-radius: 20px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(16, 17, 18, 0.2);
  text-align: center;
  animation: slideUp 0.3s ease-out;
}

.beta-popup__content h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-family: "Shippori Mincho", serif;
  font-size: 24px;
}

.beta-popup__content p {
  color: var(--ink-soft);
  margin-bottom: 24px;
  line-height: 1.5;
}

.beta-popup__actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}