:root {
  --ink: #1c1712;
  --paper: #f4eee4;
  --card: #fffaf3;
  --gold: #8a6a2b;
  --btn: #24382f;
  --btn-hover: #1a2a23;
  --alert: #7a2e24;
  --muted: #6b6258;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top, #3a3228 0%, var(--ink) 55%);
  color: var(--ink);
}

.shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid #e4d8c4;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
}

h1 {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 700;
}

.lead,
.meta {
  color: var(--muted);
  line-height: 1.5;
}

.lead {
  margin: 0 0 22px;
  font-size: 14px;
}

.meta {
  font-size: 13px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 13px;
  margin-top: 8px;
}

input,
select {
  width: 100%;
  border: 1px solid #d7cbb8;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
  background: var(--paper);
}

input:focus {
  outline: 2px solid var(--gold);
  border-color: var(--gold);
}

button {
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--btn);
  color: #f4eee4;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  background: var(--btn-hover);
}

.alert {
  background: #f8e7e3;
  color: var(--alert);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.banner {
  background: #e7f0e6;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.text-link {
  color: var(--gold);
}

.top {
  background: rgba(28, 23, 18, 0.92);
  color: #f4eee4;
  position: sticky;
  top: 0;
}

.top-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang {
  display: flex;
  gap: 8px;
}

.lang-link {
  color: #cfc3b0;
  text-decoration: none;
  font-size: 13px;
}

.lang-link.on {
  color: #e6d3a3;
  font-weight: 700;
}

.brand {
  color: #e6d3a3;
  text-decoration: none;
  font-weight: 700;
}

nav a {
  color: #f4eee4;
  text-decoration: none;
  margin-left: 14px;
  font-size: 14px;
}

.shell-app {
  align-items: flex-start;
  padding-top: 28px;
}

.card.wide {
  width: min(840px, 100%);
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.secondary {
  margin-top: 0;
  background: #5c4a32;
  white-space: nowrap;
}

.text-btn {
  margin: 0;
  background: transparent;
  color: var(--gold);
  padding: 4px 8px;
  font-size: 14px;
}

.picker {
  position: fixed;
  inset: 0;
  background: rgba(28, 23, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.picker[hidden] {
  display: none;
}

.picker-card {
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  background: var(--card);
  border-radius: 16px;
  padding: 16px 18px 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.picker-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.picker-head h2 {
  margin: 0;
  font-size: 18px;
  text-align: center;
}

.picker-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pick-cat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #e4d8c4;
}

.pick-cat span {
  color: var(--muted);
  font-size: 13px;
}

.pick-flavor[disabled] {
  opacity: 0.55;
  cursor: default;
}

.results {
  border: 1px solid #d7cbb8;
  border-radius: 8px;
  background: #fff;
  max-height: 240px;
  overflow: auto;
  margin-top: 4px;
}

.hit {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  margin: 0;
  border-radius: 0;
  border-bottom: 1px solid #efe6d8;
  padding: 8px 12px;
}

.hit span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.hit:hover {
  background: var(--paper);
}

.empty {
  padding: 10px 12px;
  color: var(--muted);
}

.flavor-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.flavor-row {
  display: grid;
  grid-template-columns: 1fr 110px 64px;
  gap: 8px;
  align-items: center;
}

.flavor-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.flavor-row .remove {
  margin: 0;
  background: #7a2e24;
  padding: 8px 10px;
  font-size: 13px;
}

.total {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 15px;
}

.total.ok {
  background: #e7f0e6;
}

.total.bad {
  background: #f8e7e3;
  color: var(--alert);
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.grid th,
table.grid td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #e4d8c4;
}

table.grid tr.base {
  color: var(--muted);
}

.history {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history li {
  border-bottom: 1px solid #e4d8c4;
}

.history a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
}

.lookup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.lookup button {
  margin-top: 0;
}

@media (max-width: 700px) {
  .grid-2,
  .grid-3,
  .flavor-row,
  .lookup-row,
  .search-row {
    grid-template-columns: 1fr;
  }
}
