/* ひとて: a shop-like layout. One main action per screen, big tiles with price tags,
   gray page with white panels, a tab bar at the bottom. */
:root {
  --bg: #f4f4f2;
  --card: #ffffff;
  --ink: #1b1a19;
  --muted: #6e6a65;
  --line: #e3e1dd;
  --chip: #efedea;
  --accent: #e8531f;
  --accent-ink: #ffffff;
  --accent-soft: #fdede6;
  --ok: #1e7f48;
  --ok-soft: #e4f3ea;
  --warn: #8a5300;
  --warn-bg: #fff3dc;
  --danger: #c62d22;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --t0: #fde9e0; --t1: #e6eefc; --t2: #e9f4e3; --t3: #fcf1d4; --t4: #efe8fa;
  --t5: #e1f3f0; --t6: #fce6ee; --t7: #eceef2; --t8: #fff0da;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --card: #1d1c1b;
    --ink: #ecebe8;
    --muted: #a39f99;
    --line: #2f2d2b;
    --chip: #2a2826;
    --accent: #ff7440;
    --accent-ink: #1b0e08;
    --accent-soft: #3a2117;
    --ok: #5fc98b;
    --ok-soft: #173023;
    --warn: #f0b35a;
    --warn-bg: #2f2616;
    --danger: #ff7a70;
    --shadow: none;
    --t0: #3a2218; --t1: #1c2a42; --t2: #1f3120; --t3: #3a3017; --t4: #2b2240;
    --t5: #16322d; --t6: #3a1c28; --t7: #262a31; --t8: #3a2a15;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.7;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
body.has-action { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top, main, .foot { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; position: sticky; top: 0; z-index: 10;
  background: var(--card); border-bottom: 1px solid var(--line);
  max-width: none; padding: 0 max(16px, calc((100% - 728px) / 2));
}
.top nav a { margin-left: 16px; text-decoration: none; font-weight: 700; font-size: 0.9rem; }
.brand { font-size: 1.3rem; font-weight: 900; letter-spacing: 0.04em; text-decoration: none; color: var(--accent); }
.foot { padding-top: 32px; padding-bottom: 24px; font-size: 0.85rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
h1 { font-size: 1.45rem; line-height: 1.45; margin: 20px 0 8px; }
h2 { font-size: 1.1rem; margin: 0; }
h3 { font-size: 1rem; margin: 0 0 4px; line-height: 1.45; }
.grow { flex: 1; min-width: 0; }

/* ---- buttons ---- */
button, .btn {
  font: inherit; font-weight: 800; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  border: 1px solid var(--accent); border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  text-decoration: none; text-align: center; cursor: pointer;
}
button.sub, .btn.sub { background: var(--card); color: var(--accent); }
button.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
button.small, .btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; font-weight: 700; }
button:disabled { opacity: 0.5; cursor: default; }
.wide { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.row.center { justify-content: center; }
.row.two > button { flex: 1; }

/* ---- home ---- */
.hero { padding: 8px 0 4px; }
.hero h1 { font-size: 1.7rem; margin-top: 16px; }
.hero .lead { margin: 0 0 12px; }
.who { color: var(--accent); font-weight: 800; font-size: 0.85rem; margin: 16px 0 0; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 12px; }
.role {
  display: flex; flex-direction: column; gap: 4px; padding: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
}
.role .who { margin: 0; font-size: 0.78rem; }
.role .what { font-size: 1.15rem; font-weight: 900; }
.role .why { font-size: 0.82rem; color: var(--muted); flex: 1; line-height: 1.5; }
.role .btn { margin-top: 8px; min-height: 42px; }
.banner {
  display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 12px 14px;
  background: var(--accent-soft); color: var(--ink); border-radius: 12px; text-decoration: none; line-height: 1.5;
}
.banner.plain { background: var(--card); border: 1px solid var(--line); }
.banner svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
.banner small { color: var(--muted); }
.chev { font-size: 1.5rem; color: var(--muted); line-height: 1; }
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 10px; }
.sec a { font-size: 0.9rem; font-weight: 700; text-decoration: none; }
.trust { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trust > div { background: var(--card); border-radius: 12px; padding: 12px; font-size: 0.82rem; color: var(--muted); line-height: 1.5; }
.trust b { display: block; color: var(--ink); font-size: 0.95rem; margin-bottom: 2px; }

/* ---- tiles ---- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile {
  display: block; overflow: hidden; background: var(--card); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.tile:hover .name { color: var(--accent); }
.thumb { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.thumb .emoji { font-size: 3rem; line-height: 1; }
.pill {
  position: absolute; left: 0; bottom: 10px; padding: 1px 10px 1px 8px;
  background: rgba(20, 20, 20, 0.72); color: #fff; font-weight: 800; font-size: 0.88rem;
  border-radius: 0 999px 999px 0;
}
.flag {
  position: absolute; left: 8px; top: 8px; padding: 1px 8px; border-radius: 4px;
  background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 800;
}
.tile .body { padding: 8px 10px 10px; }
.tile .name { font-size: 0.95rem; font-weight: 800; margin: 0; }
.tile .sub {
  margin: 2px 0 0; font-size: 0.78rem; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tone-0 { background: var(--t0); } .tone-1 { background: var(--t1); } .tone-2 { background: var(--t2); }
.tone-3 { background: var(--t3); } .tone-4 { background: var(--t4); } .tone-5 { background: var(--t5); }
.tone-6 { background: var(--t6); } .tone-7 { background: var(--t7); } .tone-8 { background: var(--t8); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
button.chip {
  flex: none; min-height: 36px; padding: 4px 14px; border-radius: 999px; font-size: 0.9rem; font-weight: 700;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
}
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }

/* ---- item detail ---- */
.detail-hero { margin: 0 -16px; aspect-ratio: 16 / 9; max-height: 300px; display: grid; place-items: center; }
.detail-hero .emoji { font-size: 5rem; line-height: 1; }
.big-price { font-size: 1.6rem; font-weight: 900; margin: 0 0 6px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; }
.badges + h1 { margin-top: 6px; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 4px; vertical-align: middle;
  background: var(--chip); color: var(--ink); font-size: 0.75rem; font-weight: 800; line-height: 1.7;
}
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
h3 .badge { margin-left: 6px; }
.kv { display: grid; grid-template-columns: 6.5em 1fr; gap: 4px 12px; margin: 8px 0; }
.kv.wide { grid-template-columns: 7.5em 1fr; }
.kv dt { color: var(--muted); font-size: 0.9rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
ol.plain, ul.plain { margin: 6px 0; padding-left: 1.3em; }
ol.plain li, ul.plain li { margin: 4px 0; }

/* ---- panels and forms (white rows on the gray page) ---- */
.panel { background: var(--card); margin: 14px -16px 0; padding: 2px 16px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.panel-title { font-size: 0.85rem; color: var(--muted); font-weight: 800; padding: 14px 0 2px; }
label { display: block; margin: 14px 0 6px; font-weight: 800; font-size: 0.95rem; }
.req { margin-left: 8px; padding: 0 6px; border-radius: 3px; background: var(--danger); color: #fff; font-size: 0.7rem; vertical-align: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, input[type=number]:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 72px; resize: vertical; }
.hint { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.tier {
  position: relative; margin: 0; padding: 10px 6px; text-align: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 700; font-size: 0.9rem;
}
.tier input { position: absolute; opacity: 0; pointer-events: none; }
.tier .p { display: block; font-size: 1.05rem; font-weight: 900; }
.tier:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tier:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pick {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px; cursor: pointer; line-height: 1.35;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 0.9rem;
}
.pick input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.pick small { display: block; color: var(--muted); font-weight: 600; font-size: 0.75rem; white-space: nowrap; }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---- rows, cards, trade page ---- */
.row-item {
  display: flex; align-items: center; gap: 12px; margin: 10px 0; padding: 10px 12px;
  background: var(--card); color: var(--ink); text-decoration: none; line-height: 1.45;
  border: 1px solid var(--line); border-radius: 12px;
}
.row-item .t { font-weight: 800; }
.row-item .s { font-size: 0.84rem; color: var(--muted); }
.mini { width: 52px; height: 52px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 1.7rem; }
.price-now { font-weight: 900; font-size: 1.15rem; white-space: nowrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 12px 0; }
.card.result { border-color: var(--ok); }
.status-hero { background: var(--card); border-radius: 14px; padding: 14px 16px 12px; margin: 16px 0 10px; border: 1px solid var(--line); }
.status-hero h1 { margin: 0; font-size: 1.3rem; }
.status-hero .status { margin: 0; font-size: 0.8rem; color: var(--muted); }
.status-hero .label { margin: 0; font-size: 1.3rem; font-weight: 900; }
.status-hero .next { margin: 2px 0 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.stats > div { background: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: 0.8rem; color: var(--muted); }
.stats b { display: block; font-size: 1.2rem; color: var(--ink); }
.stats.three { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats.cards > div { background: var(--card); border: 1px solid var(--line); }
.stats.three > div { padding: 8px; font-size: 0.72rem; }
.stats.three b { font-size: 0.98rem; white-space: nowrap; }
.profit.plus { color: var(--ok); }
.profit.minus { color: var(--danger); }
.quote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; font-size: 0.9rem; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--accent); }
label.inline { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.9rem; }
label.inline select { width: auto; }
.switch-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.switch-row .hint { flex-basis: 100%; margin: 0; }
button.switch {
  gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px; min-height: 44px;
  background: var(--chip); border-color: var(--line); color: var(--muted);
}
button.switch .knob { width: 32px; height: 32px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
button.switch.on { background: var(--ok); border-color: var(--ok); color: #fff; padding: 6px 6px 6px 16px; flex-direction: row-reverse; }
.level-name { font-size: 1.3rem; font-weight: 900; margin: 0; }
.progress { height: 10px; border-radius: 999px; background: var(--chip); overflow: hidden; margin: 8px 0 4px; }
.progress .fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ladder li { display: flex; gap: 12px; align-items: baseline; background: var(--card); border-radius: 10px; padding: 8px 12px; font-size: 0.88rem; color: var(--muted); }
.ladder b { color: var(--ink); min-width: 4em; }
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); margin: 14px 0 2px; padding: 0; }
.stepper li { list-style: none; position: relative; text-align: center; padding-top: 20px; font-size: 0.72rem; color: var(--muted); }
.stepper li::before {
  content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%; background: var(--line); z-index: 1;
}
.stepper li::after { content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.stepper li:first-child::after { display: none; }
.stepper li.done, .stepper li.now { color: var(--ink); }
.stepper li.done::before, .stepper li.now::before, .stepper li.done::after, .stepper li.now::after { background: var(--accent); }
.stepper li.now { font-weight: 900; }
.stepper li.now::before { box-shadow: 0 0 0 4px var(--accent-soft); }
.status { font-weight: 800; }
.status.ok { color: var(--ok); }
.job-head { display: flex; gap: 12px; align-items: center; }
.payout { font-size: 1.3rem; font-weight: 900; margin: 10px 0 0; }
details.box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 12px 0; }
.card details.box { border: 0; padding: 4px 0; margin: 4px 0; }
details.box summary { font-weight: 800; cursor: pointer; }
table.terms { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 8px; }
table.terms th, table.terms td { text-align: left; vertical-align: top; padding: 6px 8px; border-top: 1px solid var(--line); }
table.terms th { width: 36%; color: var(--muted); font-weight: 700; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); font-size: 0.9rem; }
.timeline li { position: relative; margin: 0 0 8px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li:last-child::before { background: var(--accent); }
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.flow li { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: 12px; padding: 10px 12px; line-height: 1.5; }
.flow .n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 0.85rem; }
.copybox { display: flex; gap: 8px; align-items: center; margin: 8px 0; padding: 10px 12px; background: var(--card); border: 1px dashed var(--line); border-radius: 10px; }
.copy { flex: 1; min-width: 0; word-break: break-all; font-family: ui-monospace, monospace; font-size: 0.85rem; }
pre.prompt { white-space: pre-wrap; font-size: 0.8rem; margin: 8px 0 0; }
code { font-family: ui-monospace, monospace; font-size: 0.85em; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 28px 16px; background: var(--card); border-radius: 14px; margin: 12px 0; }
.empty .title { font-weight: 900; font-size: 1.05rem; margin: 0; }
.list { margin-top: 8px; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin: 12px 0; }
.err { color: var(--danger); font-weight: 700; }
.tag { display: inline-block; font-size: 0.8rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; margin: 0 6px 4px 0; color: var(--muted); }

/* ---- bottom bars ---- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding: 0 max(0px, calc((100% - 760px) / 2)) env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 5px;
  color: var(--muted); text-decoration: none; font-size: 0.66rem; font-weight: 700;
}
.tabs svg { width: 24px; height: 24px; }
.tabs a { position: relative; }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs .count {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 800; line-height: 18px; text-align: center;
}
.tabs a.center { color: var(--accent); }
.tabs .dot {
  width: 46px; height: 46px; margin-top: -16px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.tabs .dot svg { width: 26px; height: 26px; }
.action {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.action .bar { width: 100%; max-width: 728px; display: flex; gap: 10px; align-items: center; }
.action .bar > button, .action .bar > .btn { flex: 1; }
.action .bar > button.sub { flex: 0 0 auto; }
