:root {
  --green: #3dcc8a;
  --green-ink: #062216;
  --gray: #3a3633;
  --danger: #ff7b7b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --nav: calc(62px + env(safe-area-inset-bottom));
  --radius: 18px;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--bg);
  background-attachment: fixed;
}
body.theme-bushido {
  --bg: #0c0b0a;
  --card: #161311;
  --ink: #f4efe8;
  --muted: #c4b5a6;
  --faint: #8d8074;
  --line: rgba(255, 106, 40, 0.22);
  --accent: #ff5a1f;
  --accent-ink: #2a1006;
  --kw: #ffd166;
  --surface: #241c17;
  --panel: #14110f;
  --nav-bg: rgba(12, 11, 10, 0.94);
  background-color: #0c0b0a;
  background-image:
    radial-gradient(circle at 0 0, transparent 18px, rgba(255, 90, 31, 0.09) 19px, transparent 21px),
    radial-gradient(circle at 28px 34px, transparent 18px, rgba(255, 90, 31, 0.07) 19px, transparent 21px),
    radial-gradient(circle at 100% 0, transparent 22px, rgba(255, 90, 31, 0.08) 23px, transparent 25px),
    radial-gradient(1200px 480px at 100% -10%, rgba(255, 90, 31, 0.2), transparent 46%),
    linear-gradient(180deg, #100e0c 0%, #070605 100%);
}
body.theme-akari {
  --bg: #fff7f8;
  --card: #ffffff;
  --ink: #1c2e2b;
  --muted: #5c6f6b;
  --faint: #8aa29c;
  --line: rgba(212, 70, 130, 0.28);
  --accent: #e23d86;
  --accent-ink: #ffffff;
  --kw: #b01258;
  --surface: #fff;
  --panel: #fffdfb;
  --nav-bg: rgba(255, 247, 248, 0.94);
  --green: #1c9a5b;
  --green-ink: #f4fff8;
  background-color: #fff4f6;
  background-image:
    radial-gradient(circle at 8% 6%, rgba(255, 182, 206, 0.95) 0 18px, transparent 19px),
    radial-gradient(circle at 14% 9%, rgba(255, 214, 226, 0.9) 0 10px, transparent 11px),
    radial-gradient(circle at 92% 4%, rgba(244, 160, 190, 0.75) 0 26px, transparent 27px),
    radial-gradient(circle at 84% 12%, rgba(255, 196, 214, 0.8) 0 12px, transparent 13px),
    radial-gradient(circle at 6% 78%, rgba(255, 186, 208, 0.55) 0 22px, transparent 23px),
    radial-gradient(circle at 96% 70%, rgba(255, 205, 220, 0.7) 0 16px, transparent 17px),
    linear-gradient(180deg, #fffdfb 0%, #ffeef3 48%, #fff8f4 100%);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.topbar {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 8;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
}
.app {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 8px 16px calc(var(--nav) + 88px);
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}
.brand {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 750;
}
.brand b {
  display: inline;
  color: inherit;
  font-size: inherit;
  font-weight: 750;
}
.place { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.switch {
  display: flex;
  background: var(--surface);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.switch button, .chips button, .opt, .diff, .choice, .mesa, .table, .nav button, .ghost, .solid, .texty {
  border: 0;
}
.switch button {
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 650;
}
.switch button.on { background: var(--accent); color: var(--accent-ink); }

.lead { color: var(--muted); margin: 0 0 14px; line-height: 1.45; font-size: 14px; }
.lead strong { color: var(--ink); font-weight: 650; }

.search {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  margin-bottom: 10px;
}
.search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 14px 0;
}
.search .x {
  background: transparent;
  color: var(--muted);
  border: 0;
  font-size: 18px;
  padding: 6px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: 0 0 auto;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}
.chips button.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.section { margin: 18px 0 8px; }
.section h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 10px;
}
.pic, .ph {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  overflow: hidden;
  padding: 0;
  background: #2c261f;
  border: 1px dashed rgba(255, 209, 102, 0.35);
  color: var(--kw);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.pic img { width: 100%; height: 100%; object-fit: cover; border: 0; }
.pic.has { border-style: solid; border-color: transparent; }
.info h3 { margin: 2px 0 4px; font-size: 16px; line-height: 1.2; }
.price { margin: 0; color: var(--accent); font-weight: 700; font-size: 13px; }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.ghost, .solid, .texty {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}
.ghost { background: transparent; border: 1px solid var(--line) !important; color: var(--ink); }
.solid { background: var(--accent); color: var(--accent-ink); }
.texty { background: transparent; color: var(--muted); padding-inline: 6px; }
.danger { color: var(--danger); }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 10px;
  line-height: 1.5;
}

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.nav button {
  position: relative;
  flex: 1;
  max-width: 180px;
  background: transparent;
  color: var(--faint);
  border-radius: 14px;
  padding: 10px 8px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.nav button.on { color: var(--ink); background: var(--surface); }
.nav button i {
  display: block;
  font-style: normal;
  font-size: 16px;
  margin-bottom: 2px;
}
.badge {
  position: absolute;
  top: 4px; right: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  line-height: 18px;
}

.cartbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav) + 8px);
  width: min(688px, calc(100% - 24px));
  z-index: 21;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 16px;
  padding: 12px 12px 12px 16px;
  box-shadow: var(--shadow);
}
.cartbar b { display: block; font-size: 14px; }
.cartbar span { font-size: 12px; opacity: 0.75; }
.cartbar button { background: var(--ink); color: var(--bg); }

.diffs { display: grid; gap: 10px; }
.diff {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  padding: 14px;
}
.diff.on { border-color: var(--accent) !important; }
.diff small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.diff b { font-size: 18px; }
.row { display: flex; gap: 8px; margin-top: 12px; }
.row .solid, .row .ghost { flex: 1; padding: 12px; }

.qcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
}
.progress { height: 6px; background: var(--surface); border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.progress span { display: block; height: 100%; background: var(--accent); }
.qcard h2 { margin: 0 0 14px; font-size: 20px; line-height: 1.3; }
.choice {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  line-height: 1.35;
}
.choice.good { background: var(--green); color: var(--green-ink); }
.choice.bad { background: #5a3030; color: #ffd0d0; }
.explain {
  background: var(--surface);
  border-radius: 14px;
  padding: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin: 8px 0 12px;
}
.score { font-size: 56px; margin: 8px 0; letter-spacing: -0.04em; }
.score span { font-size: 22px; color: var(--muted); }

.study-card h2 { margin-top: 0; }
.kw {
  background: transparent;
  border: 0;
  padding: 0 1px;
  color: var(--kw);
  font-weight: 750;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.sheet, .modal, .kwpop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal { z-index: 40; align-items: flex-end; }
.kwpop { z-index: 60; align-items: center; padding: 18px; }
.panel {
  width: min(720px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  background: var(--panel);
  color: var(--ink);
  border-radius: 22px 22px 0 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}
.kwpop .panel {
  border-radius: 22px;
  max-height: 70vh;
  padding-bottom: 16px;
}
.handle {
  width: 42px; height: 4px; border-radius: 99px;
  background: #4a433c; margin: 2px auto 12px;
}
.panel h2 { margin: 0 0 6px; font-size: 22px; }
.panel h3 { margin: 14px 0 8px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.desc { line-height: 1.5; color: var(--ink); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 12px;
  border: 1px solid transparent !important;
}
.opt.on { background: var(--accent); color: var(--accent-ink); }
.note, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  resize: vertical;
  outline: none;
}
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--surface); font-size: 20px;
}
.headrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.close {
  background: var(--surface); border: 0; border-radius: 50%;
  width: 36px; height: 36px; font-size: 18px;
}

.tables {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.table {
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--gray);
  color: #ddd;
  font-weight: 750;
  position: relative;
}
.table.on, .table.busy { background: var(--green); color: var(--green-ink); }
.table.pick { outline: 3px solid var(--ink); }
.table small {
  position: absolute;
  bottom: 3px; right: 4px;
  font-size: 9px;
}

.mesa-list { display: grid; gap: 10px; }
.mesa {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.mesa .num {
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--green); color: var(--green-ink);
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px;
}
.line {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.line p { margin: 0; }
.line.brand-bushido { border-left: 3px solid #ff5a1f; padding-left: 10px; }
.line.brand-akari { border-left: 3px solid #e23d86; padding-left: 10px; }
.line.brand-both { border-left: 3px solid #e23d86; box-shadow: inset 3px 0 0 #ff5a1f; padding-left: 10px; }
.muted { color: var(--muted); }
.banner {
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.hero-pic {
  width: 120px; height: 120px; border-radius: 50%;
  object-fit: cover; margin: 6px auto 10px;
}
.file {
  display: inline-block;
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}
.file input { display: none; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav) + 78px);
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 999px;
  z-index: 70;
  font-size: 14px;
}
[hidden] { display: none !important; }

.card.brand-bushido,
.panel.product-bushido {
  background: #120f0d;
  color: #f6f1ea;
  border: 2px solid #ff5a1f;
}
.card.brand-akari,
.panel.product-akari {
  background: #fffdfb;
  color: #1c2e2b;
  border: 2px solid #e23d86;
}
.card.brand-both,
.panel.product-both {
  background: #161311;
  color: #f6f1ea;
  border: 2px solid transparent;
  background-image: linear-gradient(#161311, #161311), linear-gradient(120deg, #ff5a1f, #e23d86);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.card.brand-bushido h3,
.panel.product-bushido h2 { color: #fff8f3; }
.card.brand-akari h3,
.panel.product-akari h2 { color: #0f6e64; }
.card.brand-both h3,
.panel.product-both h2 { color: #fff8f3; }
.card.brand-bushido .price,
.panel.product-bushido .price { color: #ff5a1f; }
.card.brand-akari .price,
.panel.product-akari .price { color: #2c4f9e; }
.card.brand-both .price,
.panel.product-both .price { color: #ffb080; }
.card.brand-bushido .ghost,
.panel.product-bushido .ghost,
.panel.product-bushido .texty { color: #f6f1ea; border-color: rgba(255, 90, 31, 0.55) !important; }
.card.brand-akari .ghost,
.panel.product-akari .ghost,
.panel.product-akari .texty { color: #0f6e64; border-color: #e23d86 !important; }
.card.brand-both .ghost,
.panel.product-both .ghost { color: #f6f1ea; border-color: #e23d86 !important; }
.card.brand-bushido .solid,
.panel.product-bushido .solid { background: #ff5a1f; color: #2a1006; }
.card.brand-akari .solid,
.panel.product-akari .solid { background: #e23d86; color: #fff; }
.card.brand-both .solid,
.panel.product-both .solid { background: #ff5a1f; color: #2a1006; }
.card.brand-bushido .pic,
.card.brand-bushido .ph,
.panel.product-bushido .ph { border: 2px solid #ff5a1f; background: #1c1612; color: #ffd166; }
.card.brand-akari .pic,
.card.brand-akari .ph,
.panel.product-akari .ph { border: 2px solid #e23d86; background: #fff0f5; color: #e23d86; }
.card.brand-both .pic,
.card.brand-both .ph { border: 2px solid #ff5a1f; }
.card.brand-bushido .kw,
.panel.product-bushido .kw { color: #ffd166; }
.card.brand-akari .kw,
.panel.product-akari .kw { color: #c2185b; }
.card.brand-both .kw,
.panel.product-both .kw { color: #ffd166; }
.panel.product-akari .desc,
.panel.product-akari .muted { color: #1c2e2b; }
.panel.product-bushido .desc,
.panel.product-both .desc { color: #f6f1ea; }
.panel.product-akari { --surface: #fff0f5; --ink: #1c2e2b; }
.panel.product-bushido,
.panel.product-both { --surface: #241c17; --ink: #f6f1ea; }
.pencil {
  border: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  padding: 0 0 0 6px;
  vertical-align: middle;
}
.panel.product-bushido .pencil,
.panel.product-both .pencil { color: #ffb080; }
.panel.product-akari .pencil { color: #e23d86; }
.panel.product-akari textarea,
.panel.product-bushido textarea,
.panel.product-both textarea { color: inherit; }

@media (min-width: 760px) {
  .panel { border-radius: 22px; margin-bottom: 24px; }
  .sheet, .modal { align-items: center; }
}
