:root {
  --bg: #141a26;
  --bg2: #1b2233;
  --card: #222c40;
  --card2: #2a3550;
  --ink: #eef2fb;
  --muted: #9aa6c0;
  --line: #33405e;
  --accent: #ffce54;
  --accent-ink: #241c00;
  --ok: #4caf7d;
  --gray: #9e9e9e; --green: #72b75b; --orange: #e2883f;
  --purple: #8c66c6; --red: #db5954; --blue: #5b8cd8; --gold: #f4cc3f;
  --sky: #4fb8ff; /* голубой — идеальная готовка */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 40px;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 0 12px; }

.app-header {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #1b2233, #1b2233ee);
  backdrop-filter: blur(6px);
  padding: 12px 12px 10px; border-bottom: 1px solid var(--line);
}
.credits { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.credits-label { font-size: 12px; color: var(--muted); }
.credit-img { height: 48px; width: auto; border-radius: 7px; border: 1px solid var(--line); }
.app-header h1 { font-size: 19px; margin: 0 0 6px; }
.day-banner {
  font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 10px;
  background: var(--card2); border: 1px solid var(--line);
}
.day-banner.today { background: #2c3a24; border-color: #4c6b32; color: #d6f0b8; }
.day-banner.off { background: #3a2c24; border-color: #6b4a32; color: #f0d6b8; }

/* panels */
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; margin: 12px 0; overflow: hidden; }
.panel-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; border: 0; color: var(--ink); font-size: 16px; font-weight: 700;
  padding: 14px; cursor: pointer;
}
.panel-head .chev { transition: transform .2s; color: var(--muted); flex: 0 0 auto; }
.panel-head[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.panel-title { flex: 0 0 auto; }
/* collapsed-state summary of the user's choices, shown in the header */
.panel-summary { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: flex-end;
  gap: 3px; margin: 0 8px; font-size: 13px; font-weight: 600; color: var(--muted);
  overflow: hidden; white-space: nowrap; }
.panel-summary img { width: 18px; height: 18px; flex: 0 0 auto; }
.panel-summary .arr, .panel-summary .dash { color: var(--muted); font-weight: 700; }
.panel-head[aria-expanded="true"] .panel-summary { display: none; }
/* exchange summary: one pair per line so it never clips on narrow screens */
.panel-summary[data-summary="exc"] { flex-direction: column; align-items: flex-end; gap: 3px; white-space: normal; }
.exc-pair { display: inline-flex; align-items: center; gap: 3px; }
.panel-body { padding: 0 14px 14px; }
.panel-body[hidden] { display: none; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.muted { color: var(--muted); }

/* locations (compact) */
.loc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.loc-card {
  display: flex; flex-direction: column; gap: 3px; align-items: center;
  background: var(--card); border: 2px solid var(--line); border-radius: 10px;
  padding: 7px 4px; cursor: pointer; color: var(--ink); text-align: center;
}
.loc-card.active { border-color: var(--accent); background: #43380f; box-shadow: inset 0 0 0 2px var(--accent); }
.loc-card .loc-name { font-weight: 700; font-size: 12px; line-height: 1.15; }
.loc-card .loc-portrait { width: 42px; height: 42px; object-fit: contain; }
/* terrain cards use the wide landscape image; 2 per row for readability */
#terrains { grid-template-columns: 1fr 1fr; }
.terrain-card .loc-portrait { width: 100%; height: 54px; }
/* shared "what you get" plate under locations / terrains */
.info-drop { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.info-drop .td-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.info-drop .td-ings { display: flex; gap: 14px; flex-wrap: wrap; }
.info-drop .ti { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; }
.info-drop .ti img { width: 40px; height: 40px; }

/* exchange */
.exc-list { display: flex; flex-direction: column; gap: 8px; }
.exc-row { display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px; }
.exc-head { display: flex; align-items: center; gap: 8px; }
.exc-head img.ing { width: 32px; height: 32px; }
.exc-head b { display: block; font-size: 14px; }
.exc-cost { font-size: 11px; color: var(--muted); }
.base-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.base-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--card2); border: 2px solid var(--line); border-radius: 10px; padding: 5px 4px; cursor: pointer; color: var(--ink); }
.base-opt.active { border-color: var(--accent); background: #43380f; box-shadow: inset 0 0 0 2px var(--accent); }
.base-opt img { width: 28px; height: 28px; }
.base-opt .amt { font-size: 11px; color: var(--muted); font-weight: 700; }
.base-opt.active .amt { color: var(--accent); }

/* inventory */
.tier-group { margin-bottom: 10px; }
.tier-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 4px 2px; }
/* equal-width columns, wide enough that names never truncate; compact rows */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); gap: 5px; }
.inv-item { display: flex; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 4px 6px; }
.inv-item img { width: 26px; height: 26px; flex: 0 0 auto; }
.inv-item .ii-main { flex: 1 1 auto; min-width: 0; }
.inv-item .ii-name { font-size: 12px; white-space: nowrap; line-height: 1.15; }
.inv-item .ii-val { font-weight: 800; font-size: 13px; color: var(--accent); }
.inv-item .ii-val.zero { color: var(--muted); font-weight: 500; }
.stepper { display: flex; gap: 3px; flex: 0 0 auto; }
.stepper button {
  width: 25px; height: 25px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--card2); color: var(--ink); font-size: 15px; line-height: 1; cursor: pointer;
}
.stepper button:active { background: var(--accent); color: var(--accent-ink); }

.ghost-btn { margin-top: 12px; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.collapse-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.collapse-link { background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 2px; }
.collapse-link:hover { color: var(--ink); }

/* results */
.results-intro { background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; margin: 14px 0 4px; font-size: 14px; font-weight: 600; color: var(--ink); }
.result-section { margin: 18px 0; }
.section-title { font-size: 17px; font-weight: 800; margin: 6px 2px 10px; display: flex; align-items: center; gap: 8px; }
.section-title .badge-today { font-size: 11px; background: var(--ok); color: #062017; padding: 3px 8px; border-radius: 20px; font-weight: 700; }
.section-count { color: var(--muted); font-weight: 500; font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 14px; }

.dish { --rc: var(--gray); display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-left: 9px solid var(--rc); border-radius: 14px; padding: 10px; margin-bottom: 10px; }
.dish[data-border="gray"] { --rc: var(--gray); }
.dish[data-border="green"] { --rc: var(--green); }
.dish[data-border="orange"] { --rc: var(--orange); }
.dish[data-border="purple"] { --rc: var(--purple); }
.dish[data-border="red"] { --rc: var(--red); }
.dish[data-border="blue"] { --rc: var(--blue); }
.dish[data-border="gold"] { --rc: var(--gold); }
/* rarity is shown by a thick coloured frame + glow around the icon */
.dish .dish-thumb { flex: 0 0 auto; }
.dish .dish-img { width: 64px; height: 64px; display: block; border-radius: 12px; background: #0003;
  border: 3px solid var(--rc); box-shadow: 0 0 10px -2px var(--rc); }
.dish .rarity-pill { display: block; text-align: center; margin-top: 5px; font-size: 10px; font-weight: 800;
  color: #10151f; background: var(--rc); border-radius: 20px; padding: 2px 6px; letter-spacing: .02em; }
.dish .dish-body { flex: 1; min-width: 0; }
.dish .dish-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dish .dish-name { font-weight: 700; font-size: 15px; }
.dish .pts { font-weight: 800; font-size: 16px; color: var(--accent); white-space: nowrap; }
.dish .pts.perfect { color: var(--sky); }
.dish .pts small { color: var(--muted); font-weight: 600; font-size: 11px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.tag.perfect { background: #143247; color: #bfe6ff; border: 1px solid #2f6f9e; }
.tag.imperfect { background: #3a3324; color: #efdca6; border: 1px solid #6b5c32; }
.tag.g-none { background: #3a1e1e; color: #ff9c9c; border: 1px solid #7a2f2f; }
.tag.g-imperfect { background: #4a3a1e; color: #f4cc3f; border: 1px solid #6b5320; }
.tag.g-perfect { background: #24402c; color: #7fe0a0; border: 1px solid #2d6b3f; }
.tag.exch { background: #2a2f50; color: #b9bde6; border: 1px solid #3a3f6b; }
.dish .effect { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.dish .effect.perfect { color: var(--sky); }
.recipe { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.recipe img { width: 28px; height: 28px; }
.recipe .tag { margin-left: 6px; }
.buy-note { font-size: 12px; color: #b9bde6; margin-top: 6px; }
.buy-note b { color: var(--accent); }
.lack-note { font-size: 12px; color: #efc27a; margin-top: 5px; }
.lack-note b { color: #ffd98a; }

.foot { margin-top: 24px; font-size: 12px; }
.foot p { margin: 6px 0; }
