:root {
  --field: #e4ddd1;
  --paper: #f6f1e8;
  --paper-deep: #efe7da;
  --ink: #221e19;
  --muted: #6e665c;
  --line: #e3d9cb;
  --green: #1d6a46;
  --green-deep: #134832;
  --danger: #8a3b32;
  --shadow: 0 18px 50px rgba(55, 42, 24, 0.08);
  --sheet: 440px;
  font-family: "IBM Plex Sans KR", sans-serif;
  color: var(--ink);
  background: var(--field);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.2)),
    var(--field);
}

button, input, textarea { font: inherit; color: inherit; }

.sheet {
  width: min(100%, var(--sheet));
  min-height: 100dvh;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.top {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 22px 14px;
  background: rgba(246, 241, 232, 0.94);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.add, .submit, .text-action {
  border: 0;
  cursor: pointer;
}

.add {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #f6f1e8;
  font-size: 0.92rem;
  font-weight: 500;
}

.add[aria-expanded="true"] { background: var(--green-deep); }

.composer {
  display: grid;
  gap: 12px;
  margin: 0 22px 8px;
  padding: 16px;
  border-radius: 18px;
  background: var(--paper-deep);
}

.composer[hidden] { display: none; }

.composer label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.composer input, .composer textarea {
  width: 100%;
  padding: 12px 12px;
  border: 0;
  border-radius: 12px;
  background: #fffdf9;
  resize: vertical;
}

.composer input:focus, .composer textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.submit {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--green);
  color: white;
  font-weight: 500;
}

.submit:disabled { opacity: 0.6; cursor: wait; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 8px 22px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 12px 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab span {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 4px;
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.hint, .empty {
  margin: 0;
  padding: 14px 22px 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.empty { padding-bottom: 48px; }

.list {
  margin: 8px 0 48px;
  padding: 0;
  list-style: none;
}

.item { border-bottom: 1px solid var(--line); }

.clip { position: relative; overflow: hidden; }

.swipe-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  display: flex;
  align-items: center;
  padding-left: 22px;
  background: var(--green);
  color: white;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.body {
  position: relative;
  background: var(--paper);
  touch-action: pan-y;
  will-change: transform;
}

.body.is-dragging { transition: none; }
.body.is-settling { transition: transform 0.22s ease; }

.word {
  display: block;
  width: 100%;
  padding: 18px 22px 8px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: Fraunces, serif;
  font-size: 1.72rem;
  font-weight: 520;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.item.open .word { padding-bottom: 6px; }

.detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}

.item.open .detail { grid-template-rows: 1fr; }

.detail-inner { overflow: hidden; }

.phonetic {
  margin: 0;
  padding: 0 22px 8px;
  color: var(--muted);
  font-size: 0.98rem;
  letter-spacing: 0.01em;
}

.meaning {
  margin: 0;
  padding: 0 22px 6px;
  color: #3f3933;
  font-size: 1.02rem;
  line-height: 1.55;
  white-space: pre-line;
}

.examples {
  display: grid;
  gap: 10px;
  padding: 4px 22px 8px;
}

.example {
  margin: 0;
  display: grid;
  gap: 2px;
}

.example-en {
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.45;
}

.example-ko {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.actions {
  display: flex;
  gap: 8px;
  padding: 4px 22px 16px;
}

.text-action {
  padding: 8px 0;
  background: transparent;
  color: var(--green-deep);
  font-size: 0.9rem;
  font-weight: 500;
}

.text-action.danger { color: var(--danger); }

@media (max-width: 440px) {
  body { background: var(--paper); }
  .sheet { box-shadow: none; }
}
