:root {
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #2c261e;
  --muted: #6d6458;
  --line: #d8cfc0;
  --sage: #2f6a4a;
  --sage-dark: #214a34;
  --sage-soft: #e4f0e6;
  --stamp: #b44532;
  --err-bg: #fdecea;
  --err-ink: #8a2b1e;
  --shadow: 0 10px 30px rgba(44, 38, 30, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 10% 0%, #fff8ec 0%, transparent 40%),
    var(--paper);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.55;
}

.page {
  width: min(1040px, calc(100% - 32px));
  margin: 36px auto 64px;
}

.methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.methods .panel { margin-bottom: 0; }

.method h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.method-lede {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.hero {
  padding: 8px 4px 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--stamp);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0 0 10px;
  font-size: 34px;
  letter-spacing: -0.03em;
}

.lede {
  margin: 0;
  max-width: 40em;
  color: var(--muted);
}

.panel, .result, .howto {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.dropzone {
  border: 2px dashed #9bb8a3;
  background: linear-gradient(180deg, #f7fff8 0%, #f4faf5 100%);
  border-radius: 14px;
  min-height: 196px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 28px 16px;
  cursor: pointer;
  outline: none;
}

.dropzone:hover, .dropzone:focus {
  border-color: var(--sage);
  background: #eef8f1;
}

.dropzone.dragover {
  border-color: var(--sage-dark);
  background: #dff0e4;
}

.drop-icon { font-size: 36px; }

.dropzone strong { font-size: 18px; }
.dropzone p { margin: 0; color: var(--muted); font-size: 14px; }

.file-name {
  margin: 0 0 14px;
  color: var(--sage-dark);
  font-weight: 500;
}

.neis-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field-row {
  display: flex;
  gap: 8px;
}

.field input[type="search"],
.field input[type="month"] {
  width: 100%;
  border: 1px solid #c9d8cc;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
}

.field input[type="search"]:focus,
.field input[type="month"]:focus {
  outline: 2px solid #9bb8a3;
  outline-offset: 1px;
}

.field-row .btn.ghost { margin-top: 0; white-space: nowrap; }

.neis-form .btn.primary { align-self: flex-start; min-width: 160px; }

.neis-warning {
  margin: 0;
  background: var(--err-bg);
  color: var(--err-ink);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 500;
  font-size: 14px;
}

.school-results { margin: 0; }

.school-note {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--stamp);
}

.school-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.school-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.school-item:hover { border-color: var(--sage); background: #f4faf5; }

.school-item.is-selected {
  border-color: var(--sage);
  background: var(--sage-soft);
  color: var(--sage-dark);
  font-weight: 700;
}

.school-picked {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.school-picked.is-set { color: var(--sage-dark); }

.error {
  margin-top: 14px;
  background: var(--err-bg);
  color: var(--err-ink);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 500;
}

.result-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.zero-kcal {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.zero-kcal input {
  width: 18px;
  height: 18px;
  accent-color: var(--sage);
  cursor: pointer;
}

.zero-kcal-hint {
  margin: 0;
  max-width: 16em;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  line-height: 1.45;
}

.result h2, .howto h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.summary { margin: 0; color: var(--muted); }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn.ghost {
  background: #fff;
  color: var(--sage-dark);
  border: 1px solid #b7d0bf;
  margin-top: 8px;
}

.btn.primary {
  background: var(--sage);
  color: #fff;
  min-width: 160px;
}

.btn.primary:hover { background: var(--sage-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--sage-soft); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td:nth-child(3) { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.menu-cell { white-space: pre-line; }

.howto ol { margin: 0 0 12px 1.2em; padding: 0; }
.howto li { margin: 8px 0; }
.notes { margin: 0; padding: 12px 12px 12px 22px; background: #f7f3ea; border-radius: 10px; color: #4d463b; }
.notes li { margin: 6px 0; }

footer { color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 800px) {
  .methods { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  h1 { font-size: 28px; }
  .result-bar { flex-direction: column; align-items: stretch; }
  .result-actions { align-items: stretch; }
  .zero-kcal-hint { max-width: none; text-align: left; }
  .btn.primary { width: 100%; }
  .field-row { flex-direction: column; }
}
