:root {
  --paper: #f7f4ee;
  --ink: #211d1a;
  --muted: #6f6760;
  --line: #ded6ca;
  --panel: #fffdf8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --coral: #d95842;
  --yellow: #f4c95d;
  --shadow: 0 18px 48px rgba(32, 24, 18, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(32px, env(safe-area-inset-bottom));
}

.masthead {
  display: grid;
  gap: 14px;
  padding: 8px 2px 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.45rem, 15vw, 5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

h1 span {
  color: var(--coral);
}

.subtitle {
  max-width: 34rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.entry-panel,
.login-panel {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.entry-panel h2,
.login-panel h2,
.list-heading h2 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

form {
  display: grid;
  gap: 12px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 82px;
  padding: 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.form-footer {
  display: grid;
  gap: 12px;
}

.form-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.primary-button,
.ghost-button,
.icon-button,
.login-button,
.word-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.login-button {
  gap: 8px;
  width: 100%;
  padding: 0 12px;
  background: var(--ink);
  color: #ffffff;
  white-space: nowrap;
}

.login-button.is-logged-in {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.primary-button {
  flex: 1;
  gap: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  padding: 0 14px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.icon-button {
  flex: 0 0 44px;
  width: 44px;
  background: var(--ink);
  color: #ffffff;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-message.error {
  color: var(--coral);
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
  padding: 10px 0;
  background: rgba(247, 244, 238, 0.94);
  backdrop-filter: blur(10px);
}

.search {
  position: relative;
  display: block;
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
}

.search input {
  padding-left: 38px;
}

.list-section {
  padding-top: 2px;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 10px;
}

#entryCount {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

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

.word-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--yellow);
  border-radius: 8px;
  background: #ffffff;
}

.word-main {
  display: grid;
  gap: 5px;
}

.word-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 1.15rem;
  line-height: 1.2;
}

.said {
  font-weight: 900;
}

.arrow {
  color: var(--muted);
  font-weight: 800;
}

.actual {
  color: var(--accent-strong);
  font-weight: 900;
}

.example {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.word-actions button {
  width: 42px;
  min-height: 42px;
  background: #f8f4eb;
  border-color: var(--line);
  color: var(--ink);
}

.word-actions button.delete {
  color: var(--coral);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.empty-state svg {
  width: 34px;
  height: 34px;
  color: var(--accent);
}

.empty-state p {
  margin: 0;
  font-weight: 800;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

@media (min-width: 680px) {
  .shell {
    padding: 34px 22px 46px;
  }

  .masthead {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
  }

  .login-button {
    width: auto;
  }

  .field-grid,
  .form-footer {
    grid-template-columns: 1fr 1fr;
  }

  .form-actions {
    grid-column: 1 / -1;
  }

  .word-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}
