*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #1a1a18;
  --muted: #c0bfba;
  --line: #e8e8e4;
  --danger: #c0392b;
  --font: ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(14px, 1vw, 24px);
}

body {
  font-family: var(--font);
  background: #fff;
  color: var(--text);
  min-height: 100dvh;
}

/* ── Setup ──────────────────────────────────────────────── */

.setup {
  max-width: 320px;
  margin: 0 auto;
  padding: 80px 32px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setup h1 {
  font-weight: 600;
  margin-bottom: 4px;
}

.field {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--line);

  font-family: var(--font);
  background: transparent;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.field:focus {
  border-color: var(--text);
}
.field::placeholder {
  color: var(--muted);
}

.btn-primary {
  padding: 10px 0;
  background: none;
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--text);

  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: opacity 0.15s;
}
.btn-primary:disabled {
  opacity: 0.25;
  cursor: default;
}

/* ── Main ───────────────────────────────────────────────── */

.main {
  padding: 0 40px 100px;
}

header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--line);
}

header h1 {
  font-weight: 600;
}

.live {
  color: #4caf76;
}

.btn-import {
  margin-left: auto;
  background: none;
  border: none;
  font-family: var(--font);

  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.12s;
}
.btn-import:hover {
  color: var(--text);
}

/* ── Grid ───────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 20vw));
  align-items: start;
}

/* ── Card — no box, top line only ───────────────────────── */

.card {
  border-top: 1px solid var(--line);
  padding: 20px 28px 28px 0;
}

.card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.card-title {
  flex: 1;

  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  cursor: pointer;
  line-height: 1.3;
}
.card-title:hover {
  color: var(--muted);
}

.title-input {
  flex: 1;

  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--font);
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  min-width: 0;
  padding: 0;
}

.btn-del-card {
  flex-shrink: 0;
  border: none;
  background: none;

  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.1s,
    color 0.1s;
  padding: 0;
  line-height: 1;
  font-family: var(--font);
}
.card:hover .btn-del-card {
  opacity: 1;
}
.btn-del-card:hover {
  color: var(--danger);
}

/* ── Recipe list ────────────────────────────────────────── */

.recipe-list {
  list-style: none;
}

.recipe-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}

/* (1) (2) text bullet */
.recipe-num {
  flex-shrink: 0;

  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.recipe-text {
  flex: 1;

  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
}
.recipe-text:hover {
  color: var(--muted);
}

.recipe-input {
  flex: 1;

  font-weight: 500;
  line-height: 1.4;
  font-family: var(--font);
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  min-width: 0;
  padding: 0;
}

.btn-del-item {
  flex-shrink: 0;
  border: none;
  background: none;

  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.1s,
    color 0.1s;
  padding: 0;
  line-height: 1;
  font-family: var(--font);
}
.recipe-row:hover .btn-del-item {
  opacity: 1;
}
.btn-del-item:hover {
  color: var(--danger);
}

/* ── Add-item footer ────────────────────────────────────── */

.card-footer {
  margin-top: 8px;
}

.new-recipe-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;

  font-family: var(--font);
  color: var(--muted);
  padding: 0;
  line-height: 1.65;
}
.new-recipe-input::placeholder {
  color: var(--muted);
}
.new-recipe-input:focus {
  color: var(--text);
}

/* ── Add-list column ────────────────────────────────────── */

.card--add {
  border-top: 1px solid var(--line);
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);

  color: var(--muted);
  padding: 20px 0 0;
  display: block;
  text-align: left;
  transition: color 0.12s;
}
.card--add:hover {
  color: var(--text);
}

.card--new {
  padding: 20px 28px 28px 0;
}

.new-list-input {
  width: 100%;

  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--font);
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 0;
}
.new-list-input::placeholder {
  color: var(--muted);
  font-weight: 700;
}

/* ── Import modal ───────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px;
}

.modal {
  background: #fff;
  border: 1px solid var(--line);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-title {
  font-weight: 700;
}

.modal-hint {
  color: var(--muted);
  line-height: 1.7;
}
.modal-hint code {
  font-family: "SF Mono", "Fira Mono", monospace;
  color: var(--text);
}

.import-textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px 0;
  border: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: "SF Mono", "Fira Mono", monospace;

  line-height: 1.75;
  background: transparent;
  color: var(--text);
  outline: none;
  resize: none;
}
.import-textarea::placeholder {
  color: var(--muted);
}

.import-preview {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.import-preview li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.import-preview strong {
  font-weight: 600;
}
.preview-count {
  color: var(--muted);
}
.import-preview-empty {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  gap: 20px;
  align-items: baseline;
}

.btn-secondary {
  background: none;
  border: none;
  font-family: var(--font);

  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.12s;
}
.btn-secondary:hover {
  color: var(--text);
}

.modal-btn-primary {
  width: auto;
  padding: 0 0 1px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--text);
  border-radius: 0;

  font-weight: 600;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  transition: opacity 0.12s;
}
.modal-btn-primary:disabled {
  opacity: 0.25;
  cursor: default;
  border-color: var(--muted);
  color: var(--muted);
}
