:root {
  color-scheme: light;
  --ink: #172121;
  --muted: #5f6868;
  --paper: #f7f4ee;
  --panel: #ffffff;
  --line: #d8ded8;
  --teal: #116466;
  --teal-dark: #0b4b4c;
  --rose: #b43c4c;
  --gold: #c78b17;
  --green: #577d4b;
  --blue: #3c6e9f;
  --shadow: 0 12px 30px rgba(23, 33, 33, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
textarea {
  font: inherit;
}

.app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 5vw, 56px);
  background: #e7eee8;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.5rem;
}

h3 {
  margin-bottom: 14px;
  font-size: 1rem;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab,
.quiet-button,
.primary-action,
.choice,
.scale {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.tab {
  flex: 0 0 auto;
  padding: 10px 16px;
  color: var(--muted);
  background: #fffaf2;
  font-weight: 700;
}

.tab.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.quiet-button,
.quiet-link,
.primary-action {
  padding: 11px 16px;
  font-weight: 800;
}

.quiet-button {
  color: var(--teal-dark);
  background: #ffffff;
}

.quiet-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--teal-dark);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.inline-link {
  color: var(--teal-dark);
  font-weight: 800;
}

.quiet-button.danger {
  color: #8c2834;
}

.primary-action {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-panel,
.translator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.intro-panel p,
.translator p {
  margin-bottom: 0;
}

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

.choice,
.scale {
  padding: 10px 12px;
  color: var(--ink);
  background: #f9fbf8;
  font-weight: 750;
}

.choice,
.scale {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.choice {
  text-align: center;
}

.scale {
  flex-direction: column;
  gap: 4px;
}

.emoji {
  font-size: 1.35rem;
  line-height: 1;
}

.choice.selected,
.scale.selected {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.colors .choice {
  color: #111;
}

.colors .selected {
  color: #fff;
  outline: 3px solid rgba(17, 100, 102, 0.24);
}

.calm {
  background: #bcd7eb;
}

.tense {
  background: #efb2b9;
}

.fog {
  background: #d8d8d8;
}

.alert {
  background: #f7dda1;
}

.safe {
  background: #cde5c6;
}

.mixed {
  background: #d7c4e8;
}

.scale-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 10px;
}

.scale {
  aspect-ratio: 1 / 1;
  font-size: 1.25rem;
}

.sentence-box,
.share-card,
.meaning-box {
  width: min(100%, 520px);
  padding: 16px;
  color: #102727;
  background: #e6f1ed;
  border: 1px solid #b9d3cb;
  border-radius: 8px;
  line-height: 1.5;
  font-weight: 750;
}

.meaning-box {
  width: 100%;
  margin-top: 12px;
  background: #fff8df;
  border-color: #e6d48d;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fbfcfa;
}

.compact {
  margin-bottom: 0;
}

textarea {
  resize: vertical;
}

.pattern-list,
.entry-list {
  display: grid;
  gap: 10px;
}

.mini-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.mini-card strong {
  display: block;
  margin-bottom: 4px;
}

.mini-card span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px;
  color: #102727;
  background: #f4e7bd;
  border: 1px solid #dfc771;
  border-radius: 8px;
  line-height: 1.45;
  font-weight: 750;
}

.overload .notice {
  color: #101818;
  background: #e9f2ef;
  border-color: #c9dfd8;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 14px;
  color: #fff;
  background: var(--teal-dark);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.overload {
  --ink: #f5f4ec;
  --muted: #d0d5cf;
  --paper: #111818;
  --panel: #182323;
  --line: #314141;
  --teal: #c9dfd8;
  --teal-dark: #f7f4ee;
  color-scheme: dark;
}

.overload .topbar {
  background: #111818;
}

.policy-topbar h1 {
  max-width: 760px;
}

.policy-page {
  display: grid;
  gap: 16px;
}

.policy-page h2 {
  font-size: 1.25rem;
}

.overload h1 {
  font-size: clamp(1.7rem, 4vw, 3rem);
}

.overload .tabs,
.overload .translator h3,
.overload .intro-panel p,
.overload .notice {
  display: none;
}

.overload .workspace {
  width: min(760px, calc(100% - 24px));
}

.overload .grid.three,
.overload .grid.two {
  grid-template-columns: 1fr;
}

.overload .choice-grid {
  grid-template-columns: 1fr;
}

.overload .choice,
.overload .scale,
.overload .quiet-button,
.overload .primary-action {
  min-height: 62px;
  font-size: 1.1rem;
}

.overload .choice,
.overload .tab,
.overload input,
.overload textarea {
  color: var(--ink);
  background: #223030;
}

.overload .choice.selected,
.overload .scale.selected,
.overload .primary-action {
  color: #101818;
  background: #d7ebe4;
  border-color: #d7ebe4;
}

.overload .sentence-box,
.overload .share-card,
.overload .meaning-box {
  color: #101818;
  background: #e9f2ef;
}

@media (max-width: 780px) {
  .topbar,
  .intro-panel,
  .translator {
    align-items: stretch;
    flex-direction: column;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 2.35rem;
  }
}
