/* 経営me — 共通スタイル（試作版のスタイル＋本番版の追加分） */
:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f7f8f5;
  --surface-3: #eef0ec;
  --border: #dfe3dc;
  --text: #1c231f;
  --muted: #687169;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f2ef;
  --good: #15803d;
  --good-soft: #e7f6ec;
  --bad: #b91c1c;
  --bad-soft: #fcebea;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --sale: #1d4ed8;
  --sale-soft: #e8eefd;
  --mat: #b58552;
  --wip: #8d98a5;
  --prod: #0f766e;
  --chip-rd: #2563eb;
  --chip-ad: #dc2626;
  --chip-edu: #ca8a04;
  --chip-pc: #16a34a;
  --chip-ins: #ea580c;
  --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 3px 10px rgba(20, 30, 25, .05);
  --radius: 12px;
  --key-bg: #fff6d6;
  --key-line: #d29a1c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --surface: #1a201d;
    --surface-2: #1f2622;
    --surface-3: #262e2a;
    --border: #2f3833;
    --text: #e6ebe7;
    --muted: #97a29a;
    --accent: #2bb3a5;
    --accent-ink: #06201d;
    --accent-soft: #163331;
    --good: #4ade80;
    --good-soft: #15291c;
    --bad: #f87171;
    --bad-soft: #351a1a;
    --warn: #f59e0b;
    --warn-soft: #33260f;
    --sale: #7aa2ff;
    --sale-soft: #1a2440;
    --mat: #c89a68;
    --wip: #9aa6b4;
    --prod: #2bb3a5;
    --chip-rd: #5b8cff;
    --chip-ad: #f05252;
    --chip-edu: #eab308;
    --chip-pc: #34c76a;
    --chip-ins: #fb7d3c;
    --key-bg: #352b12;
    --key-line: #c9921f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 3px 12px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  font-feature-settings: "palt";
}
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.35; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: .95rem; margin-top: .3em; }
p { margin: .4em 0; }
b { font-weight: 700; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.err { color: var(--bad); font-weight: 600; }
.neg { color: var(--bad); }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.boot { padding: 80px 16px; text-align: center; color: var(--muted); }

/* ---- ボタン・入力 */
.btn {
  font: inherit; font-weight: 600; font-size: .92rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 9px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: transparent; }
.btn.link { border: 0; background: none; color: var(--accent); text-decoration: underline; padding: 4px 6px; }
.btn.small { padding: 5px 10px; font-size: .84rem; }
.btn.tiny { padding: 2px 8px; font-size: .76rem; border-radius: 7px; }
.btn.icon { padding: 4px 8px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.huge { font-size: 1.15rem; padding: 14px 34px; border-radius: 12px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
input, select { font: inherit; color: var(--text); }
input[type=text], input:not([type]), select, .price-in {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 10px;
}
select { padding: 6px 8px; min-width: 64px; }
input:focus, select:focus, .btn:focus-visible, .tile:focus-visible, .opt:focus-visible, .mkt:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.price-in { width: 76px; text-align: right; font-weight: 700; font-size: 1.05rem; }
.field { display: block; margin: 10px 0; font-weight: 600; font-size: .9rem; }
.field input { display: block; width: 100%; margin-top: 4px; font-weight: 400; font-size: 1rem; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; margin: 6px 0 4px; }
.code-input { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.badge {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 99px;
  background: var(--surface-3); color: var(--muted); margin-left: 4px; vertical-align: middle; white-space: nowrap;
}
.badge.me { background: var(--accent-soft); color: var(--accent); }
.badge.cpu { background: var(--sale-soft); color: var(--sale); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.turn { background: var(--accent); color: var(--accent-ink); }
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-right: 6px; }
.pill.sale { background: var(--sale-soft); color: var(--sale); }
.pill.good { background: var(--good-soft); color: var(--good); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; flex: none; }

/* ---- ホーム */
.home { max-width: 920px; margin: 0 auto; padding: 32px 16px 48px; }
.hero { text-align: center; margin-bottom: 26px; }
.hero-mark { color: var(--accent); display: inline-block; margin-bottom: 6px; }
.hero h1 { font-size: 1.9rem; letter-spacing: .02em; }
.hero p { color: var(--muted); max-width: 560px; margin: 8px auto 0; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.home-grid .card.emph { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.disclaimer { color: var(--muted); font-size: .78rem; text-align: center; margin-top: 18px; }

/* ---- 上部バー */
#topbar { position: sticky; top: 0; z-index: 20; }
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; }
.brand svg { width: 26px; height: 26px; }
.brand span { color: var(--text); letter-spacing: .02em; }
.tb-room .code, .big-code { font-weight: 800; letter-spacing: .14em; color: var(--accent); }
.tb-period b { font-size: 1.15rem; }
.tb-period span { color: var(--muted); margin-left: 6px; font-size: .88rem; }
.rev { margin-left: 8px; color: var(--warn); font-weight: 700; font-size: .82rem; }
.tb-turn { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tb-turn .muted { font-size: .86rem; margin-left: 4px; }
.tb-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.net-down { color: var(--warn); font-weight: 700; font-size: .85rem; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: 280px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px;
}
.menu > button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: .9rem; background: none; border: 0;
  color: var(--text); padding: 9px 10px; border-radius: 7px; cursor: pointer;
}
.menu > button:hover { background: var(--surface-3); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-label { font-size: .78rem; color: var(--muted); padding: 2px 10px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; margin: 4px 0; flex-wrap: wrap; }
.seg button { font: inherit; font-size: .85rem; border: 0; background: var(--surface); color: var(--text); padding: 6px 12px; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.menu .seg { margin: 4px 10px 6px; }

/* ---- ロビー */
.lobby { max-width: 1000px; margin: 0 auto; padding: 18px 16px 40px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
.lobby .span2 { grid-column: 1 / -1; }
.room-head { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.big-code { font-size: 2.2rem; line-height: 1.1; }
.invite { flex: 1; min-width: 220px; }
.copyrow { display: flex; gap: 6px; }
.copyrow input { flex: 1; min-width: 0; font-size: .85rem; }
.plist { list-style: none; padding: 0; margin: 0 0 10px; }
.plist li { display: flex; align-items: center; gap: 2px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.plist li:last-child { border-bottom: 0; }
.plist .pname { font-weight: 600; margin-right: 4px; }
.plist .btn { margin-left: auto; }
.settings { display: grid; gap: 10px; margin-bottom: 8px; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; font-size: .92rem; }
.waiting { color: var(--muted); font-weight: 600; text-align: center; padding: 10px; }
.howto { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.howto div { background: var(--surface-2); border-radius: 10px; padding: 12px; }
.howto b { display: block; margin-bottom: 4px; color: var(--accent); }
.howto span { font-size: .86rem; color: var(--muted); }

/* ---- ゲーム画面 */
.game { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; padding: 16px; max-width: 1440px; margin: 0 auto; align-items: start; }
.col-main, .col-side { display: grid; gap: 16px; min-width: 0; }
.col-main > div:empty, .col-side > div:empty { display: none; }
.action.mine { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.turn-hero { text-align: center; padding: 14px 0 6px; }
.turn-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 12px; color: var(--accent); }
.turn-hero .muted { margin-top: 10px; }
.wait { font-size: 1.05rem; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.decide-head { margin-bottom: 12px; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile {
  font: inherit; text-align: left; cursor: pointer; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-left: 5px solid var(--muted);
  border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-height: 66px;
  transition: transform .08s, background .15s, border-color .15s;
}
.tile:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-1px); }
.tile:disabled { opacity: .5; cursor: not-allowed; }
.tile-name { font-weight: 700; }
.tile-desc { font-size: .8rem; color: var(--muted); }
.tile-mat { border-left-color: var(--mat); }
.tile-wip { border-left-color: var(--wip); }
.tile-prod { border-left-color: var(--prod); }
.tile-rd { border-left-color: var(--chip-rd); }
.tile-ad { border-left-color: var(--chip-ad); }
.tile-edu { border-left-color: var(--chip-edu); }

.form-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 1.05rem; }
.form-head .muted { font-size: .88rem; }
.formrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.formrow label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.form-foot .btns { display: flex; gap: 8px; margin-left: auto; }
.callout { background: var(--surface-2); border-radius: 9px; padding: 9px 12px; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 6px 0 8px; }
.opt {
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.opt:disabled { opacity: .5; cursor: not-allowed; }
.opt .price { font-weight: 700; color: var(--accent); }
.opt .muted { font-size: .8rem; }
.mkts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 8px; }
.mkt {
  font: inherit; color: var(--text); cursor: pointer; text-align: center;
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 10px; padding: 8px 4px;
  display: flex; flex-direction: column; font-size: .82rem; line-height: 1.4;
}
.mkt b { font-size: .95rem; }
.mkt.on { border-color: var(--accent); background: var(--accent-soft); }
.mkt:disabled { opacity: .4; cursor: not-allowed; }

/* 入札 */
.sale-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 1.02rem; margin-bottom: 8px; }
.respond { background: var(--sale-soft); border-radius: 10px; padding: 12px 14px; margin: 8px 0; }
.respond .form-foot { border-top-color: color-mix(in srgb, var(--sale) 25%, transparent); }
.resp-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.resp-list li { display: flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px; font-size: .85rem; }
.resp-list li span { margin-left: 6px; font-weight: 700; color: var(--muted); }
.resp-list li.done span { color: var(--sale); }
.resp-list li.wait span { color: var(--warn); }

/* 直近の出来事 */
.events { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.ev-title { font-weight: 700; margin-bottom: 6px; font-size: .92rem; }
.ev-title .muted { font-weight: 400; font-size: .82rem; margin-left: 4px; }
.riskcard { border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.riskcard.bad { background: var(--bad-soft); }
.riskcard.good { background: var(--good-soft); }
.rc-name { font-weight: 800; font-size: 1.05rem; margin-bottom: 2px; }
.riskcard.bad .rc-name { color: var(--bad); }
.riskcard.good .rc-name { color: var(--good); }
tr.win td { background: var(--good-soft); }

/* 自社の盤 */
.board-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.board-head h2 { margin: 0; }
.cash-big { margin-left: auto; text-align: right; }
.cash-big span { display: block; font-size: .78rem; color: var(--muted); }
.cash-big b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 8px; align-items: stretch; }
.zone { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; min-height: 104px; }
.zone-title { font-size: .8rem; font-weight: 700; color: var(--muted); }
.pcs { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; margin: 6px 0; }
.zone-n { font-weight: 800; font-size: 1.1rem; text-align: right; }
.arrow { display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--muted); font-size: 1.2rem; }
.arrow span { font-size: .7rem; }
.pc { display: inline-block; width: 15px; height: 15px; border-radius: 4px; }
.pc.mat { background: var(--mat); }
.pc.wip { background: var(--wip); border-radius: 50%; }
.pc.prod { background: var(--prod); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); }
.more { font-size: .78rem; color: var(--muted); align-self: center; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--surface-2); border-radius: 9px; padding: 8px 10px; }
.stat > span { display: block; font-size: .76rem; color: var(--muted); }
.stat b { font-size: 1.2rem; }
.stat b small { font-size: .74rem; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat.wide { grid-column: span 2; }
.mach { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 1px 6px; margin: 2px 4px 2px 0; }
.mach small { background: var(--surface-3); border-radius: 4px; padding: 0 4px; font-size: .72rem; }
.mach.large { border-color: var(--accent); color: var(--accent); }
.chip { display: inline-block; font-size: .72rem; font-weight: 800; color: #fff; border-radius: 99px; padding: 0 7px; margin: 2px 3px 2px 0; line-height: 1.6; }
.chip.big { font-size: .8rem; padding: 1px 9px; }
.chip-rd { background: var(--chip-rd); }
.chip-ad { background: var(--chip-ad); }
.chip-edu { background: var(--chip-edu); color: #2a2100; }
.chip-pc { background: var(--chip-pc); }
.chip-ins { background: var(--chip-ins); }
.fin { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 12px; }
.fin > div { background: var(--surface); padding: 7px 10px; }
.fin span { display: block; font-size: .74rem; color: var(--muted); }
.fin b { font-variant-numeric: tabular-nums; }
.fin b small { font-weight: 400; color: var(--muted); }
.brule { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.brule-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.brule-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.bform { margin-top: 10px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.bform .form-foot { margin-top: 8px; padding-top: 8px; }

/* サイド */
.side h3 { margin-bottom: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .76rem; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 5px 6px; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.compact td { padding: 4px 6px; }
.tbl td.cap { display: flex; align-items: center; gap: 6px; }
.bar { flex: 1; height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 40px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.cos { display: grid; gap: 8px; }
.co { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--surface-2); }
.co.active { border-color: var(--accent); background: var(--accent-soft); }
.co.mine .co-head b { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.co-head { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.co-cash { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.co-row { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .82rem; align-items: center; margin-top: 3px; }
.co-actions { margin-top: 4px; text-align: right; }
.log { list-style: none; padding: 0; margin: 0; max-height: 360px; overflow-y: auto; font-size: .82rem; }
.log li { padding: 4px 2px; border-bottom: 1px solid var(--border); }
.log li:last-child { border-bottom: 0; }
.lg-big { font-weight: 700; color: var(--accent); }
.lg-risk { color: var(--bad); }
.lg-good { color: var(--good); }
.lg-sale { color: var(--sale); }
.lg-warn { color: var(--warn); }
.lg-muted { color: var(--muted); }

/* ---- 決算 */
.results { max-width: 1240px; margin: 0 auto; padding: 18px 16px 48px; display: grid; gap: 16px; }
.res-title { font-size: 1.6rem; margin: 4px 0 0; }
.tabs { margin: 0; }
.scroll { overflow-x: auto; }
.tbl.res td, .tbl.res th { white-space: nowrap; }
.tbl.res tbody tr { cursor: pointer; }
.tbl.res tbody tr:hover td { background: var(--surface-2); }
.tbl.res tr.sel td { background: var(--accent-soft); }
.tbl.res tr.mine td:nth-child(2) { font-weight: 700; }
.tbl.res .rank { font-weight: 800; color: var(--accent); }
.tbl.overview tbody tr { cursor: default; }
.tbl.overview td { vertical-align: middle; }
.tbl.res .eq { font-weight: 800; }
.res-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pod { text-align: center; padding: 10px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pod.p1 { background: var(--accent-soft); }
.pod-rank { font-size: 1.4rem; font-weight: 900; color: var(--accent); }
.pod span { color: var(--muted); font-size: .88rem; }
.mqbox { display: flex; gap: 0; align-items: flex-start; margin: 4px 0 10px; max-width: 420px; }
.mqc { flex: 1; display: flex; flex-direction: column; }
.mqb { display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: .8rem; border: 1px solid var(--surface); overflow: hidden; color: #fff; min-height: 0; }
.mqb b { font-size: .92rem; }
.mqb.pq { background: #3b6b8f; }
.mqb.vq { background: #8d98a5; }
.mqb.mq { background: #0f766e; }
.mqb.f { background: #b58552; }
.mqb.g { background: #15803d; }
.mqb.loss { background: #b91c1c; }
.mqb.ghost { background: transparent; border-color: transparent; }
.pvmq { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.pvmq div { background: var(--surface-2); border-radius: 8px; padding: 6px 8px; }
.pvmq span { display: block; font-size: .72rem; color: var(--muted); }
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tbl.st tr.hl td { font-weight: 700; background: var(--surface-2); }
.tbl.st td.ind { padding-left: 16px; color: var(--muted); }
.bs { display: grid; gap: 8px; }
.chart { width: 100%; height: auto; }
.chart .gl { stroke: var(--border); stroke-width: 1; }
.chart .base { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; margin-top: 6px; }
.next { text-align: center; padding: 8px 0; }

/* ---- モーダル・トースト */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 15, 12, .45); z-index: 50; }
.modal-box {
  position: fixed; z-index: 51; left: 50%; top: 4vh; transform: translateX(-50%);
  width: min(1100px, calc(100vw - 24px)); max-height: 92vh; display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal-body { overflow-y: auto; padding: 16px; display: grid; gap: 16px; }
.rules { max-width: 860px; }
.rules h3 { margin-top: 1.2em; color: var(--accent); }
.rules ol, .rules ul { padding-left: 1.4em; margin: .4em 0; }
.rules li { margin: .2em 0; }
.rules td:first-child { white-space: nowrap; vertical-align: top; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); font-size: .9rem;
  animation: tin .25s ease-out; transition: opacity .35s, transform .35s;
}
.toast.error { border-left-color: var(--bad); }
.toast.risk { border-left-color: var(--bad); background: var(--bad-soft); }
.toast.good { border-left-color: var(--good); background: var(--good-soft); }
.toast.sale { border-left-color: var(--sale); background: var(--sale-soft); }
.toast.out { opacity: 0; transform: translateX(20px); }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- 狭い画面 */
@media (max-width: 1100px) {
  .game { grid-template-columns: minmax(0, 1fr) 330px; }
  .mkts { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .game, .lobby, .res-grid, .home-grid { grid-template-columns: minmax(0, 1fr); }
  .events, .st-grid { grid-template-columns: minmax(0, 1fr); }
  .howto { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 14px; }
  .game, .lobby, .results { padding: 12px 16px 32px; gap: 12px; }
  .topbar { padding: 8px 16px; gap: 6px 10px; }
  .brand span, .tb-room { display: none; }
  .tb-right { margin-left: 0; width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .card { padding: 12px; }
  .flow { grid-template-columns: 1fr; }
  .arrow { flex-direction: row; gap: 6px; transform: none; }
  .arrow::after { content: ""; }
  .stats, .fin { grid-template-columns: 1fr 1fr; }
  .stat.wide { grid-column: span 2; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .mkts { grid-template-columns: repeat(2, 1fr); }
  .howto { grid-template-columns: 1fr; }
  .pvmq { grid-template-columns: 1fr 1fr; }
  .podium { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.5rem; }
  .big-code { font-size: 1.8rem; }
  .menu { right: -8px; width: min(280px, calc(100vw - 32px)); }
}

/* ================================================================ 本番版の追加 */
.hidden { display: none !important; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 10px; }
.danger { color: var(--bad); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.sale { background: var(--sale); border-color: var(--sale); color: #fff; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
input[type=email], input[type=password], input[type=url], textarea {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--text);
}
textarea { width: 100%; min-height: 70px; }
.field2 { display: block; font-weight: 700; font-size: .86rem; margin: 8px 0; }
.field2 input, .field2 select, .field2 textarea { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
.hint { font-size: .78rem; color: var(--muted); font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fx-pill { font-size: .8rem; font-weight: 800; padding: 2px 10px; border-radius: 99px; background: var(--sale-soft); color: var(--sale); white-space: nowrap; }
.fx-pill.high { background: var(--warn-soft); color: var(--warn); }
.war-pill { font-size: .8rem; font-weight: 800; padding: 2px 10px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); }
.admin-tag { font-size: .78rem; font-weight: 800; color: #fff; background: var(--warn); border-radius: 6px; padding: 1px 8px; }
.center-box { max-width: 460px; margin: 60px auto; padding: 0 16px; }
.banner { border-radius: 10px; padding: 10px 14px; font-size: .9rem; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--sale-soft); color: var(--sale); }

/* 上部2段目：為替・手番の順番 */
.tb-status { flex-basis: 100%; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 0 10px; border-top: 1px solid var(--border); }
.ts-strip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ts-label { font-size: .8rem; font-weight: 800; color: var(--muted); margin-right: 2px; }
.ts { position: relative; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); color: var(--muted); font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ts.me { border: 2.5px solid var(--accent); color: var(--accent); background: var(--accent-soft); }
.ts.me::after { content: "あなた"; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 1px; font-size: .58rem; font-weight: 800; color: var(--accent); white-space: nowrap; }
.ts.now { width: 32px; height: 32px; background: var(--text); border-color: var(--text); color: var(--bg); font-size: .98rem; box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 20%, transparent); }
.ts.now.me { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts.away { opacity: .45; }
.ts-info { font-size: .88rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ts-key { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--text); }
.ts-key.mine { background: var(--accent); }
.ts-key.me { border: 2.5px solid var(--accent); background: var(--accent-soft); }
.ts-sep { color: var(--border); margin: 0 2px; }

/* 今のターン：やること → 選んだこと → 決めること */
.turnbox { border: 2px solid var(--accent); border-radius: 14px; background: var(--surface); overflow: hidden; box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.turnbox.other { border-color: var(--border); box-shadow: var(--shadow); }
.turnbox.respond { border-color: var(--sale); box-shadow: 0 0 0 4px var(--sale-soft), var(--shadow); }
.tb-head { background: var(--accent); color: var(--accent-ink); padding: 8px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 800; }
.turnbox.other .tb-head { background: var(--surface-3); color: var(--text); }
.turnbox.respond .tb-head { background: var(--sale); color: #fff; }
.tb-head small { font-weight: 600; opacity: .85; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--border); }
.step { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
.step:last-child { border-right: 0; }
.step .lab { font-size: .78rem; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.step .no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); font-weight: 800; font-size: .8rem; color: var(--muted); }
.step .val { font-weight: 800; margin-top: 3px; font-size: 1rem; }
.step .val .muted { font-weight: 500; font-size: .86rem; }
.step.done .no { background: var(--good); color: #fff; }
.step.now { background: var(--accent-soft); }
.step.now .no { background: var(--accent); color: var(--accent-ink); }
.step.now .lab { color: var(--accent); }
.turnbox.respond .step.now { background: var(--sale-soft); }
.turnbox.respond .step.now .no { background: var(--sale); color: #fff; }
.turnbox.respond .step.now .lab { color: var(--sale); }
.tb-body { padding: 14px 16px; }
.redo { font: inherit; font-size: .76rem; font-weight: 600; margin-left: 6px; color: var(--accent); text-decoration: underline; background: none; border: 0; cursor: pointer; padding: 0; }
.dest { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.mkt-big { display: inline-flex; align-items: baseline; gap: 6px; background: var(--sale-soft); color: var(--sale); border-radius: 8px; padding: 2px 10px; font-weight: 800; font-size: 1.05rem; }
.mkt-big small { font-weight: 600; font-size: .78rem; }
.staffgrid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px 14px; align-items: center; margin: 6px 0; }
.staffgrid .h { font-size: .76rem; color: var(--muted); font-weight: 700; }

/* 参加企業：社名・社長・入札額・自分用メモ */
.corp { list-style: none; padding: 0; margin: 0; }
.corp li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.corp li:last-child { border-bottom: 0; }
.corp-top { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.corp-top b { font-size: .95rem; }
.ord { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); font-size: .72rem; font-weight: 800; color: var(--muted); margin-right: 2px; }
.ceo { font-size: .82rem; color: var(--muted); font-weight: 700; margin-left: 2px; }
.corp li.me-row { background: var(--accent-soft); border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.bidamt { margin-left: auto; font-size: .82rem; font-weight: 700; color: var(--sale); white-space: nowrap; }
.bidamt.none { color: var(--muted); font-weight: 500; }
.memo { width: 100%; margin-top: 4px; font-size: .82rem; padding: 4px 8px !important; border: 1px dashed var(--border) !important; background: var(--surface-2) !important; }

/* チャット */
.chat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
.chat-head h3 { margin: 0; }
.seg.mini button { padding: 3px 10px; font-size: .8rem; }
.unread { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 800; margin-left: 4px; padding: 0 4px; }
.msgs { list-style: none; padding: 0; margin: 0 0 8px; max-height: 260px; overflow-y: auto; font-size: .86rem; }
.msgs li { padding: 6px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.msgs li.mine { text-align: right; }
.msgs li.private { background: var(--warn-soft); border-radius: 6px; padding: 6px 8px; }
.who { font-weight: 700; margin-right: 6px; }
.who.op { color: #fff; background: var(--accent); border-radius: 6px; padding: 0 6px; font-size: .78rem; }
.t { color: var(--muted); font-size: .72rem; margin-left: 4px; }
.chat-input { display: flex; gap: 6px; }
.chat-input input { flex: 1; min-width: 0; }
.btn.mic.on { background: var(--bad); border-color: var(--bad); color: #fff; }

/* 決算・成績 */
.statement-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.firebox { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }

/* 管理画面 */
.admin { max-width: 1280px; margin: 0 auto; padding: 18px 16px 40px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.admin .span2 { grid-column: 1 / -1; }
.col { display: grid; gap: 16px; min-width: 0; }
.ptable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ptable th { text-align: left; font-size: .74rem; color: var(--muted); font-weight: 700; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.ptable td { padding: 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ptable input { width: 100%; padding: 4px 8px; font-size: .86rem; }
.st-badge { display: inline-block; font-size: .74rem; font-weight: 700; border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.st-badge.in { background: var(--good-soft); color: var(--good); }
.st-badge.sent { background: var(--sale-soft); color: var(--sale); }
.st-badge.no { background: var(--surface-3); color: var(--muted); }
.st-badge.bad { background: var(--bad-soft); color: var(--bad); }
.sendbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 12px; background: var(--sale-soft); border-radius: 10px; }
.mail { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: .86rem; overflow: hidden; }
.mail-h { padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.mail-b { padding: 10px 12px; white-space: pre-wrap; line-height: 1.75; overflow-wrap: anywhere; }
.cpu-rows { list-style: none; padding: 0; margin: 0; }
.cpu-rows li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.cpu-rows input { flex: 1; min-width: 0; padding: 4px 8px; font-size: .88rem; }
.lv { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex: none; }
.lv button { font: inherit; font-size: .78rem; font-weight: 700; border: 0; border-right: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: 4px 10px; cursor: pointer; }
.lv button:last-child { border-right: 0; }
.lv .lv-weak.on { background: #65a30d; color: #fff; }
.lv .lv-normal.on { background: var(--sale); color: #fff; }
.lv .lv-strong.on { background: var(--bad); color: #fff; }
.lv-legend { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 12px 0 8px; font-size: .82rem; }
.lv-legend dt { margin: 0; }
.lv-legend dd { margin: 0; color: var(--muted); }
.lvtag { display: inline-block; font-size: .72rem; font-weight: 800; color: #fff; border-radius: 6px; padding: 0 7px; }
.lvtag.weak { background: #65a30d; }
.lvtag.normal { background: var(--sale); }
.lvtag.strong { background: var(--bad); }
.cost { display: flex; flex-direction: column; gap: 2px; background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.fx { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 10px; }
.fx-card { border: 1.5px solid var(--border); border-radius: 12px; padding: 8px 12px; background: var(--surface-2); font-size: .84rem; text-align: left; font-family: inherit; color: var(--text); cursor: pointer; }
.fx-card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.fx-card:disabled { cursor: default; }
.fx-card h4 { margin: 0 0 2px; font-size: 1rem; }
.fx-card ul { margin: 0; padding-left: 1.1em; }
.good { color: var(--good); font-weight: 700; white-space: nowrap; }
.bad { color: var(--bad); font-weight: 700; white-space: nowrap; }
.setlabel { font-weight: 700; font-size: .9rem; margin: 10px 0 4px; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.fixed { font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 99px; padding: 1px 10px; }
.order { list-style: none; padding: 0; margin: 8px 0; counter-reset: o; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: .88rem; }
.order li { counter-increment: o; display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.order li::before { content: counter(o); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .78rem; flex: none; }
.ready { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--good); }
.summary3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.summary3 div { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.summary3 span { display: block; font-size: .76rem; color: var(--muted); font-weight: 700; }
.summary3 b { font-size: 1.2rem; }
.tbl.adm td, .tbl.adm th { white-space: nowrap; vertical-align: middle; }
.tbl.adm tr.now td { background: var(--accent-soft); }
.eqbar { display: inline-block; width: 80px; height: 7px; border-radius: 99px; background: var(--surface-3); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.eqbar i { display: block; height: 100%; background: var(--accent); }
.human-tag { font-size: .74rem; font-weight: 800; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 7px; }
.games-list { list-style: none; padding: 0; margin: 0; }
.games-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.games-list li:last-child { border-bottom: 0; }
.games-list .info { flex: 1; min-width: 0; }
.meter { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 6px 0 4px; }
.meter i { display: block; height: 100%; background: var(--warn); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .9rem; }
.kv b { text-align: right; }
.lg-admin { color: var(--warn); font-weight: 700; }
.linkcell { font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .statement-grid, .grid2, .fx, .order, .summary3, .dest { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .steps { grid-template-columns: 1fr; }
  .step { border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ---- トップページ */
.landing { max-width: 720px; margin: 24px auto 40px; padding: 0 16px; display: grid; gap: 14px; }
.landing .hero { margin-bottom: 0; }
.landing .lead { font-size: 1.05rem; }
.landing .points { list-style: none; padding: 0; margin: 16px auto 0; max-width: 560px; text-align: left; display: grid; gap: 8px; }
.landing .points li { background: var(--soft, rgba(15,118,110,.07)); border-radius: 10px; padding: 9px 12px; font-size: .93rem; }

/* ---- 決算書：経営判断に使う数字（枠で囲み、薄く塗る） */
.tbl.st tr.key td { font-weight: 700; background: var(--key-bg); border-top: 2px solid var(--key-line); border-bottom: 2px solid var(--key-line); }
.tbl.st tr.key td:first-child { border-left: 2px solid var(--key-line); }
.tbl.st tr.key td:last-child { border-right: 2px solid var(--key-line); }
.key-box { border: 2px solid var(--key-line); background: var(--key-bg); border-radius: 10px; }
.pvmq.key-box { padding: 6px; }
.pvmq.key-box div { background: var(--surface); }
.key-line { padding: 7px 10px; margin: 10px 0 6px; font-size: .92rem; }
.key-note { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); margin: 0 0 6px; }
.key-swatch { width: 18px; height: 12px; border: 2px solid var(--key-line); background: var(--key-bg); border-radius: 3px; flex: none; }

/* ---- 設定：価格表 */
.file-btn { cursor: pointer; }
.steps-list { margin: 6px 0 10px; padding-left: 20px; }
.change-list { margin: 4px 0 0; padding-left: 18px; columns: 2; column-gap: 24px; }
.change-list li { break-inside: avoid; }
@media (max-width: 700px) { .change-list { columns: 1; } }
