/* =========================================================
   献立メーカー（仮） — kitchen-notebook design
   ========================================================= */

:root {
  --paper: #FBF7EF;
  --paper-line: #E4DAC4;
  --card: #F0E9D8;
  --ink: #2A2620;
  --green: #2F4B3C;
  --green-soft: #3F6350;
  --yolk: #E8B23D;
  --yolk-deep: #C88A1F;
  --tomato: #C65D3B;
  --muted: #6E6A5D;

  --font-display: "Zen Maru Gothic", sans-serif;
  --font-body: "Zen Kaku Gothic New", sans-serif;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;

  --shadow-card: 0 2px 0 var(--paper-line), 0 14px 30px -18px rgba(42, 38, 32, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(ellipse 900px 500px at 12% -10%, rgba(232, 178, 61, 0.14), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(47, 75, 60, 0.10), transparent 55%),
    var(--paper);
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

:focus-visible {
  outline: 3px solid var(--yolk-deep);
  outline-offset: 2px;
  border-radius: 6px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* ===== Header ===== */

.app-header {
  padding: 28px 0 18px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px dashed var(--paper-line);
  padding-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(42,38,32,0.08));
}

.brand-text h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  margin: 0;
  color: var(--green);
  letter-spacing: 0.01em;
}

.brand-kari {
  font-weight: 500;
  font-size: 0.7em;
  color: var(--muted);
  margin-left: 2px;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ===== Layout / screens ===== */

.app-main {
  padding-top: 6px;
}

.screen[hidden] { display: none; }

.page-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 30px 26px 32px;
  box-shadow: var(--shadow-card);
  position: relative;
  animation: cardIn 0.35s ease both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--yolk-deep);
  text-transform: uppercase;
  margin: 0 0 8px;
}

.screen-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 25px;
  line-height: 1.4;
  color: var(--green);
  margin: 0 0 10px;
}

.screen-lead {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 24px;
}

.back-btn {
  background: none;
  border: none;
  
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  margin-bottom: 18px;
  display: inline-flex;
}

.back-btn:hover { color: var(--green); }

.link-btn {
  background: none;
  border: none;
  color: var(--green-soft);
  font-weight: 700;
  font-size: 13.5px;
  margin-top: 22px;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ===== Top screen choices ===== */

.top-choices {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--paper-line);
  border-radius: var(--radius-md);
  padding: 20px 20px 18px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.choice-card:hover {
  transform: translateY(-2px);
  border-color: var(--yolk);
  box-shadow: 0 10px 20px -14px rgba(42,38,32,0.4);
}

.choice-img{
  width: 380px;
  margin: 0 auto;
  border-radius: 20px;
}

.choice-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--green);
  margin: 0 auto;
}

.choice-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 auto;
}

/* ===== Ingredient input ===== */

.ingredient-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.text-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s ease;
}

.text-input:focus { border-color: var(--yolk); outline: none; }

.add-btn {
  background: var(--green);
  color: var(--paper);
  font-weight: 700;
  font-size: 14.5px;
  padding: 0 22px;
  border: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, transform 0.15s ease;
}

.add-btn:hover { background: var(--green-soft); transform: translateY(-1px); }

.ingredient-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 42px;
  margin-bottom: 26px;
  padding: 4px 0 2px;
}

.empty-hint {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  margin: 6px 0;
}

.ingredient-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1.5px solid var(--paper-line);
  border-radius: 999px;
  padding: 7px 8px 7px 15px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  animation: tagPop 0.25s ease both;
}

@keyframes tagPop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.tag-remove {
  background: var(--paper-line);
  border: none;
  color: var(--ink);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.tag-remove:hover { background: var(--tomato); color: #fff; }

/* ===== Genre picker (radio row, inside leftover form) ===== */

.genre-picker { margin-bottom: 22px; }

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  margin: 0 0 10px;
}

.genre-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.genre-radio {
  position: relative;
}

.genre-radio input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}

.genre-radio span {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--paper-line);
  background: var(--paper);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s ease;
}

.genre-radio input:checked + span {
  background: var(--green);
  border-color: var(--green);
  color: var(--paper);
  font-weight: 700;
}

.genre-radio input:focus-visible + span {
  outline: 3px solid var(--yolk-deep);
  outline-offset: 2px;
}

/* ===== Genre grid (dedicated genre screen) ===== */

.genre-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.genre-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 2px solid var(--paper-line);
  border-radius: var(--radius-md);
  padding: 24px 10px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.genre-card:hover {
  transform: translateY(-3px);
  border-color: var(--yolk);
}

.genre-img{
  width: 150px;
  border-radius: 20px;
}

.genre-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--green);
}

@media (max-width: 420px) {
  .genre-grid { grid-template-columns: 1fr; }
  .genre-card { flex-direction: row; justify-content: flex-start; padding: 16px 20px; }
}

/* ===== Buttons: primary / secondary ===== */

.primary-btn {
  width: 100%;
  background: var(--yolk);
  color: #3A2A0C;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  padding: 15px;
  border: none;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 0 var(--yolk-deep);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--yolk-deep); }

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  width: 100%;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  font-size: 14.5px;
  padding: 13px;
  border: 2px solid var(--green);
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.secondary-btn:hover { background: rgba(47,75,60,0.08); }

.danger-btn {
  color: var(--tomato);
  border-color: var(--tomato);
}

.danger-btn:hover { background: rgba(198,93,59,0.08); }

.form-error {
  color: var(--tomato);
  font-size: 13.5px;
  font-weight: 500;
  margin: -8px 0 16px;
}

/* ===== Loading screen ===== */

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 70px 26px;
}

.loading-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid var(--paper-line);
  border-top-color: var(--yolk-deep);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--green);
  font-size: 15px;
}

/* ===== Result screen ===== */

.dish-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 26px;
}

.dish-item {
  background: var(--paper);
  border: 1.5px solid var(--paper-line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.dish-category {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: var(--yolk-deep);
  background: rgba(232,178,61,0.16);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.dish-name {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink);
}

.ingredient-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 6px;
}

@media (max-width: 480px) {
  .ingredient-summary { grid-template-columns: 1fr; }
}

.ingredient-summary-col {
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: 16px 16px 14px;
  border: 1.5px solid var(--paper-line);
}

.used-col { border-left: 4px solid var(--green-soft); }
.need-col { border-left: 4px solid var(--tomato); }

.ingredient-summary-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  margin: 0 0 10px;
  color: var(--green);
}

.need-col .ingredient-summary-title { color: var(--tomato); }

.ingredient-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ingredient-summary-list li {
  font-size: 13.5px;
  color: var(--ink);
  padding-left: 14px;
  position: relative;
}

.ingredient-summary-list li::before {
  content: "・";
  position: absolute;
  left: 0;
  color: var(--muted);
}

.ingredient-summary-empty {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

.result-actions .secondary-btn,
.result-actions .primary-btn {
  flex: 1;
}

/* ===== Shopping list (receipt style) ===== */

.receipt-card {
  background: var(--paper);
  border: 1.5px dashed var(--paper-line);
}

.shopping-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border-top: 2px dashed var(--paper-line);
  padding-top: 4px;
}

.shopping-empty {
  padding: 20px 0;
  color: var(--muted);
  font-size: 13.5px;
  font-style: italic;
  text-align: center;
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px dashed var(--paper-line);
  animation: tagPop 0.2s ease both;
}

.shopping-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--green-soft);
  background: var(--card);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  font-size: 14px;
  font-weight: 900;
  transition: background 0.15s ease;
}

.shopping-checkbox.checked {
  background: var(--green-soft);
}

.shopping-label {
  flex: 1;
  font-size: 15px;
  color: var(--ink);
  transition: color 0.15s ease, opacity 0.15s ease;
}

.shopping-item.is-checked .shopping-label {
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.7;
}

.shopping-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 6px;
}

.shopping-remove:hover { color: var(--tomato); }

/* ===== Modal ===== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 38, 32, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.5);
}

.modal h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--green);
  margin: 0 0 12px;
  font-size: 18px;
}

.modal-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 16px;
}

.modal .text-input { width: 100%; margin-bottom: 18px; }

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .secondary-btn,
.modal-actions .primary-btn {
  flex: 1;
}