/* 辞令：紙UI（社内文書の上で遊ぶ）
 * トークンは :root に1組だけ。画面ごとに変えるのは装飾の量だけ。
 * 差し色は朱（ハンコ）1色＋蛍光ペン。
 * マスの色と付箋の色は「意味を持つ色」として例外的に持つ（盤面の情報そのものなので）。
 */
:root {
  /* 面 */
  --paper-bg: #e9e6df;
  --paper: #fcfbf8;
  --card: #fff;
  --card-sunken: #f4f1ea;

  /* 文字（4段） */
  --ink: #22252b;
  --ink-strong: #1b1d24;
  --ink-soft: #6f6a60;
  --ink-faint: #8a8577;

  /* 線 */
  --line: #e3ded2;
  --line-strong: #cbc4b4;
  --line-row: #eae4d7;
  --line-dash: #d8d2c4;

  /* 差し色（朱）と蛍光ペン */
  --accent: #c8321f;
  --accent-dark: #962415;
  --accent-soft: #fbe3de;
  --marker: #ffe94d;
  --on-accent: #fff;

  /* 意味を持つ色 */
  --ok: #1b7f9e;
  --ng: #b31f34;
  --ng-soft: #d7b3ba;
  --focus: #1b7f9e;
  --up: #1f7a45;
  --down: #b31f34;

  /* マス（盤面の意味色。インクの色味に寄せる） */
  --panel-blue: #2b62b8;
  --panel-blue-weak: #e6eefb;
  --panel-yellow: #9a7400;
  --panel-yellow-weak: #fff6c9;
  --panel-green: #2a7a49;
  --panel-green-weak: #e3f2e6;
  --panel-red: #a8321f;
  --panel-red-weak: #f8e1dc;
  --panel-person: #6a4cb0;
  --panel-person-weak: #eee8f9;

  /* 付箋（手札の分類） */
  --fusen-work: #d9e8ff;
  --fusen-social: #ffd9e4;
  --fusen-self: #d9f2d2;
  --fusen-rest: #fff1a8;
  --tape: rgb(200 50 31 / 0.82);

  --font-sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;

  --radius: 12px;
  --radius-btn: 9px;
  --tap: 44px;
  --shell: 480px;
  --shadow-card: 0 1px 2px rgb(40 32 15 / 0.04), 0 6px 18px rgb(40 32 15 / 0.06);

  --z-header: 100;
  --z-bar: 110;
  --z-overlay: 250;
  --z-toast: 300;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:where(button, a, input, textarea, select, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

body {
  min-height: 100vh;
  background: var(--paper-bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  padding-bottom: calc(190px + env(safe-area-inset-bottom));
}
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex-shrink: 0; }
.up-text { color: var(--up); font-weight: 800; }
.down-text { color: var(--down); font-weight: 800; }
.marked { background: linear-gradient(transparent 66%, var(--marker) 66%); padding: 0 3px; }

/* ---------- 480pxの紙の帯 ---------- */
.topbar, .container, .actionbar-inner { max-width: var(--shell); margin-left: auto; margin-right: auto; }
.container {
  min-height: calc(100vh - 60px);
  background: var(--paper);
  box-shadow: 0 0 26px rgb(30 25 15 / 0.1);
  padding: 16px 16px 24px;
  outline: none;
}

/* ---------- 上部 ---------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-header);
  background: var(--paper);
  border-bottom: 2px solid var(--ink-strong);
}
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 16px; }
.topbar-inner > div:first-child { min-width: 0; display: flex; align-items: center; gap: 10px; }
.brand {
  font-family: var(--font-serif); font-weight: 700; font-size: 18px; line-height: 1;
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2.5px solid var(--accent); color: var(--accent); transform: rotate(-8deg);
}
.brand-sub { font-size: 13px; font-weight: 800; color: var(--ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.topbar-end { display: flex; align-items: center; gap: 8px; }
.topbar-date { font-size: 12px; text-align: right; color: var(--ink-soft); line-height: 1.45; white-space: nowrap; }

/* ---------- 見出し：読む画面はテープ、操作する画面（盤面）はバー ---------- */
.section { margin-top: 26px; }
.section:first-child { margin-top: 0; }
.section-title {
  display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 5px 12px 4px;
  background: var(--tape); color: #fff; border-radius: 3px; transform: rotate(-1.2deg);
  font-size: 14px; font-weight: 800; letter-spacing: 0.06em;
}
.section-title .muted, .section-title a { color: rgb(255 255 255 / 0.9); font-weight: 600; font-size: 12px; letter-spacing: 0; }
[data-tab="home"] .section-title {
  display: flex; width: 100%; justify-content: flex-start; transform: none;
  background: none; color: var(--ink-strong); border-radius: 0;
  padding: 0 0 8px; border-bottom: 2px solid var(--ink-strong); font-weight: 900; letter-spacing: 0.04em;
}
[data-tab="home"] .section-title::before { content: ""; width: 8px; height: 16px; background: var(--accent); border-radius: 1px; align-self: center; }
[data-tab="home"] .section-title .muted, [data-tab="home"] .section-title a { margin-left: auto; color: var(--ink-soft); }

/* ---------- カード・行 ---------- */
.card, .rows, .log, .jirei {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.card { padding: 16px; }
.card + .card { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 50px; }
.row + .row { border-top: 1px dashed var(--line-dash); }
[data-tab="home"] .row + .row { border-top: 1px solid var(--line-row); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 800; color: var(--ink-strong); }
.row-sub { font-size: 13px; color: var(--ink-soft); line-height: 1.6; }
.row-end { flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; }
.row-btn { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 52px; cursor: pointer; }
.row-btn:hover { background: var(--card-sunken); }
.row-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.rows > .row-btn + .row-btn { border-top: 1px solid var(--line-row); }
.empty { padding: 16px; color: var(--ink-soft); font-size: 14px; }
.warn-card { background: var(--accent-soft); border-color: var(--ng-soft); }

.chip {
  display: inline-block; font-size: 12px; line-height: 1.6; padding: 1px 8px; border-radius: 999px;
  background: var(--card-sunken); color: var(--ink-soft); white-space: nowrap; font-weight: 700;
}
.chip.ok { background: var(--ink-strong); color: #fff; }
.chip.ng { background: var(--card-sunken); color: var(--ink); border: 1px solid var(--line-strong); }
.chip.accent { background: var(--accent); color: #fff; }
.chip.boost { background: var(--marker); color: var(--ink-strong); }

.meter { height: 8px; border-radius: 4px; background: var(--card-sunken); overflow: hidden; margin-top: 4px; }
.meter > i { display: block; height: 100%; background: var(--ink-strong); border-radius: 4px; }
.meter.warn > i { background: var(--accent); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 9px 14px; border-radius: var(--radius-btn);
  border: 1.5px solid var(--line-strong); background: var(--card); color: var(--ink-strong);
  font-weight: 800; text-decoration: none; white-space: nowrap; transition: transform 0.04s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent-dark); color: var(--on-accent); }
.btn.block { width: 100%; }
.btn.big { min-height: 54px; font-size: 18px; }
.btn.go { font-size: 17px; }
.btn:disabled { background: var(--card-sunken); color: var(--ink-faint); border-color: var(--line); cursor: not-allowed; }
.btn.sound { min-width: 44px; padding: 0; }
.btn.stack { flex-direction: column; gap: 0; min-height: 52px; font-size: 12px; padding: 4px 2px; line-height: 1.3; }

.choice {
  display: block; width: 100%; text-align: left; min-height: var(--tap);
  padding: 12px 14px; border-radius: var(--radius-btn); border: 1.5px solid var(--line-strong);
  background: var(--card); font-weight: 700; line-height: 1.6; transition: transform 0.04s;
}
.choice + .choice { margin-top: 8px; }
.choice:hover:not(:disabled) { background: var(--card-sunken); }
.choice:active:not(:disabled) { transform: translateY(1px); }
.choice .note { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; font-weight: 500; }
.choice:disabled { background: var(--card-sunken); color: var(--ink-faint); border-color: var(--line); cursor: not-allowed; }

/* ---------- 下部の固定バー ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: var(--z-bar);
}
.actionbar-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 16px;
  background: var(--paper); border-top: 2px solid var(--ink-strong);
}
.actionbar-inner .wide { grid-column: 1 / -1; }
.actionbar-inner.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-bar);
  display: grid; grid-template-columns: repeat(3, 1fr);
  max-width: var(--shell); margin: 0 auto;
  background: var(--card); border-top: 1px solid var(--line-strong);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; align-items: center; justify-content: center; min-height: 56px;
  text-decoration: none; font-size: 14px; font-weight: 700; color: var(--ink-soft);
}
.tabbar a[aria-current="page"] { background: var(--ink-strong); color: #fff; }

/* ---------- HUD（名刺） ---------- */
.hud {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 18px 16px 14px;
}
.hud::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 84px; height: 20px; translate: -50% 0;
  background: rgb(255 233 77 / 0.75); transform: rotate(-3deg);
}
.hud-rank { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hud-badge { font-family: var(--font-serif); font-size: 24px; font-weight: 700; color: var(--ink-strong); background: linear-gradient(transparent 62%, var(--marker) 62%); padding: 0 4px; }
.hud-dept { font-size: 13px; color: var(--ink-soft); }
.hud-gauge { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--ink-soft); }
.hud-bar { height: 12px; border-radius: 6px; background: var(--card-sunken); border: 1px solid var(--line); overflow: hidden; }
.hud-bar i { display: block; height: 100%; background: var(--accent); transition: width 0.6s cubic-bezier(.2,1.4,.4,1); }
.hud-gauge-num { font-weight: 900; color: var(--ink-strong); }
.hud-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hud-chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 10px;
  border: 1.5px solid var(--line-strong); border-radius: 999px; font-size: 13px; color: var(--ink); text-decoration: none; background: var(--card);
}
.hud-chip b { font-size: 15px; color: var(--ink-strong); }
.hud-chip.stock small { font-size: 11px; font-weight: 800; margin-left: 2px; }
.hud-chip.stock.up small { color: var(--up); }
.hud-chip.stock.down small { color: var(--down); }
.hud-chip.combo { background: var(--accent); border-color: var(--accent-dark); color: #fff; font-weight: 900; }

/* ---------- 能力タイル ---------- */
.pstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pstat { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.pstat-top { display: flex; justify-content: space-between; align-items: center; }
.pstat-label { font-size: 12px; color: var(--ink-soft); white-space: nowrap; font-weight: 700; }
.pstat-lv { font-size: 11px; font-weight: 900; color: var(--ink-strong); background: var(--marker); padding: 0 6px; border-radius: 4px; }
.pstat-value { font-size: 24px; font-weight: 900; color: var(--ink-strong); line-height: 1.3; font-variant-numeric: tabular-nums; }
.pstat-bar { height: 5px; border-radius: 3px; background: var(--card-sunken); overflow: hidden; }
.pstat-bar i { display: block; height: 100%; background: var(--ink-strong); }
.pstat.s-stress .pstat-bar i { background: var(--panel-yellow); }
.pstat.warn { background: var(--accent-soft); border-color: var(--ng-soft); }
.pstat.warn .pstat-value { color: var(--accent); }
.pstat.warn .pstat-bar i { background: var(--accent); }
.pstat.flash-up { animation: flashUp 0.7s ease-out; }
.pstat.flash-down { animation: flashDown 0.7s ease-out; }
@keyframes flashUp { 0% { background: var(--marker); } 100% { background: var(--card); } }
@keyframes flashDown { 0% { background: var(--accent-soft); } 100% { background: var(--card); } }

.qbar { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 14px; align-items: center; }
.qbar-item b { font-size: 16px; color: var(--ink-strong); }

/* ---------- 盤面（カレンダーのマス） ---------- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: 56px; gap: 8px;
  overflow-x: auto; padding: 22px 4px 16px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.panel {
  position: relative; height: 66px; border-radius: 8px; scroll-snap-align: center;
  background: var(--card); border: 1.5px solid var(--line-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.panel-no { position: absolute; top: 2px; left: 5px; font-size: 10px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.panel-mark { display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.1; }
.panel-mark small { font-size: 10px; font-weight: 800; }
.panel.p-blue { background: var(--panel-blue-weak); border-color: var(--panel-blue); color: var(--panel-blue); }
.panel.p-yellow { background: var(--panel-yellow-weak); border-color: var(--panel-yellow); color: var(--panel-yellow); }
.panel.p-green { background: var(--panel-green-weak); border-color: var(--panel-green); color: var(--panel-green); }
.panel.p-red { background: var(--panel-red-weak); border-color: var(--panel-red); color: var(--panel-red); }
.panel.p-person { background: var(--panel-person-weak); border-color: var(--panel-person); color: var(--panel-person); }
.panel.p-event { background: var(--card); border: 1.5px dashed var(--ink-strong); color: var(--ink-strong); }
.panel.p-start, .panel.p-goal { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
.panel.p-start .panel-no, .panel.p-goal .panel-no { color: rgb(255 255 255 / 0.75); }
.panel.past { background: var(--card-sunken); border-color: var(--line); color: var(--ink-faint); }
.panel.past .panel-mark { text-decoration: line-through; }
.panel.dest { outline: 4px solid var(--accent); outline-offset: 2px; animation: destPulse 0.9s ease-in-out infinite; }
.panel.dest::after { content: "ここ"; white-space: nowrap; position: absolute; bottom: -11px; left: 50%; translate: -50% 0; font-size: 10px; font-weight: 900; color: var(--ink-strong); background: var(--marker); padding: 0 5px; border-radius: 3px; line-height: 1.6; }
@keyframes destPulse { 50% { transform: translateY(-4px); } }
.token {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%) rotate(-8deg);
  width: 32px; height: 32px; border-radius: 50%; background: var(--card);
  border: 2.5px solid var(--accent); color: var(--accent);
  font-family: var(--font-serif); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgb(40 32 15 / 0.2);
}
.panel.hop .token { animation: hop 0.5s cubic-bezier(.3,1.6,.5,1); }
@keyframes hop { 0% { transform: translate(-50%, 10px) rotate(-8deg) scale(0.6); } 60% { transform: translate(-50%, -14px) rotate(-8deg) scale(1.15); } 100% { transform: translate(-50%, 0) rotate(-8deg) scale(1); } }
.legend { margin-top: 6px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; }
.lg { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid; margin-right: 3px; vertical-align: -3px; }
.lg.p-blue { background: var(--panel-blue-weak); border-color: var(--panel-blue); color: var(--panel-blue); }
.lg.p-yellow { background: var(--panel-yellow-weak); border-color: var(--panel-yellow); color: var(--panel-yellow); }
.lg.p-green { background: var(--panel-green-weak); border-color: var(--panel-green); color: var(--panel-green); }
.lg.p-red { background: var(--panel-red-weak); border-color: var(--panel-red); color: var(--panel-red); }
.lg.p-person { background: var(--panel-person-weak); border-color: var(--panel-person); color: var(--panel-person); }

/* ---------- 手札（付箋） ---------- */
.hand { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding-top: 14px; }
.pcard {
  position: relative; min-height: 126px; padding: 14px 4px 8px; border: 0; border-radius: 2px 2px 10px 2px;
  background: var(--fusen, var(--fusen-work)); color: var(--ink-strong);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  box-shadow: 0 1px 1px rgb(40 32 15 / 0.1), 0 4px 8px rgb(40 32 15 / 0.12);
  transition: transform 0.12s;
}
.pcard:nth-child(odd) { transform: rotate(-1.5deg); }
.pcard:nth-child(even) { transform: rotate(1.2deg); }
.pcard::before {
  content: ""; position: absolute; top: -7px; left: 50%; width: 34px; height: 14px; translate: -50% 0;
  background: rgb(255 255 255 / 0.65); border: 1px solid rgb(0 0 0 / 0.06);
}
.pcard.cat-work { --fusen: var(--fusen-work); }
.pcard.cat-social { --fusen: var(--fusen-social); }
.pcard.cat-self { --fusen: var(--fusen-self); }
.pcard.cat-rest { --fusen: var(--fusen-rest); }
.pcard-cat { font-size: 10px; font-weight: 900; letter-spacing: 0.12em; color: var(--ink-soft); }
.pcard-step {
  width: 38px; height: 38px; border-radius: 50%; background: var(--card); color: var(--ink-strong);
  border: 2px solid var(--ink-strong); font-size: 22px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.pcard-icon { line-height: 0; }
.pcard-name { font-size: 11px; font-weight: 800; line-height: 1.35; text-align: center; word-break: break-all; }
.pcard:hover:not(:disabled) { transform: translateY(-4px) rotate(0); }
.pcard.selected { background: var(--accent); color: #fff; transform: translateY(-14px) rotate(0) scale(1.05); box-shadow: 0 8px 16px rgb(40 32 15 / 0.25); }
.pcard.selected .pcard-cat { color: rgb(255 255 255 / 0.85); }
.pcard.selected .pcard-step { background: var(--marker); border-color: var(--ink-strong); }
.pcard.fresh { animation: flipIn 0.5s cubic-bezier(.2,1.4,.4,1); }
@keyframes flipIn { 0% { transform: rotateY(90deg) translateY(20px); } 100% { transform: rotateY(0); } }
.pcard:disabled { background: var(--card-sunken); color: var(--ink-faint); box-shadow: none; cursor: not-allowed; }
.pcard:disabled .pcard-step { border-color: var(--ink-faint); color: var(--ink-faint); }
.hand-hint { margin-top: 12px; background: var(--card); border: 1px dashed var(--line-dash); border-radius: 10px; padding: 8px 12px; min-height: 3.4em; }

/* ---------- 辞令（ホーム下部） ---------- */
.jirei { position: relative; padding: 22px 16px; font-family: var(--font-serif); }
.jirei-label { font-size: 13px; color: var(--ink-soft); letter-spacing: 0.3em; }
.jirei-name { font-size: 20px; margin-top: 8px; }
.jirei-body { font-size: 17px; margin-top: 8px; line-height: 1.8; padding-right: 76px; }
.jirei-body strong { font-size: 24px; letter-spacing: 0.05em; }
.jirei-company { font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.jirei .hanko { position: absolute; right: 16px; top: 50%; transform: translateY(-50%) rotate(-8deg); }

.hanko {
  width: 60px; height: 60px; border-radius: 50%; border: 3px solid var(--accent); color: var(--accent);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 700; line-height: 1.1;
}
.hanko b { font-size: 24px; }
.hanko span { font-size: 9px; letter-spacing: 0.1em; }
.hanko.filled { background: var(--accent); color: #fff; }
.hanko.big { width: 112px; height: 112px; border-width: 4px; }
.hanko.big b { font-size: 52px; }
.hanko.big span { font-size: 12px; }
.hanko.stamp { animation: stamp 0.45s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes stamp { 0% { transform: scale(2.6) rotate(-20deg); opacity: 0; } 70% { transform: scale(0.9) rotate(-8deg); opacity: 1; } 100% { transform: scale(1) rotate(-8deg); } }

/* ---------- 歩み ---------- */
.log-item { display: grid; grid-template-columns: 5.5em 1fr; gap: 8px; padding: 8px 14px; font-size: 14px; }
.log-item + .log-item { border-top: 1px dashed var(--line-dash); }
.log-item time { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.log-item.milestone span { font-weight: 800; }
.demerit-mark { color: var(--accent); }

/* ---------- 実績バッジ ---------- */
.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.badge {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 10px; border-radius: 10px; background: var(--card-sunken); color: var(--ink-faint); border: 1px dashed var(--line-strong);
}
.badge-ico { grid-row: 1 / 3; line-height: 0; }
.badge-name { font-weight: 900; font-size: 14px; }
.badge-desc { font-size: 11px; line-height: 1.4; }
.badge.got { background: var(--marker); color: var(--ink-strong); border: 1px solid var(--panel-yellow); }

/* ---------- 株価 ---------- */
.spark { width: 100%; height: 90px; margin-top: 8px; }
.spark-base { stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 4 4; }
.spark-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark.up .spark-line { stroke: var(--up); }
.spark.down .spark-line { stroke: var(--down); }
.inline-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-row .input { flex: 1; }

/* ---------- シート（書類） ---------- */
.sheet {
  border: 0; padding: 0; width: min(var(--shell), 100%); max-width: 100%; max-height: 88dvh;
  margin: auto auto 0; border-radius: 14px 14px 0 0; background: var(--paper); color: var(--ink);
}
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 14px; } }
.sheet::backdrop { background: rgb(27 29 36 / 0.5); }
.sheet-inner { padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 88dvh; }
.sheet-from { font-size: 13px; color: var(--ink-soft); }
.sheet-title { font-size: 20px; font-weight: 900; color: var(--ink-strong); margin-top: 4px; line-height: 1.5; }
.sheet-body { margin-top: 12px; }
.sheet-actions { margin-top: 22px; }
.sheet-result { margin-top: 16px; padding: 12px 14px; background: var(--card); border: 1px dashed var(--line-strong); border-radius: 10px; }
.sheet-result.bad { background: var(--accent-soft); border-color: var(--ng-soft); }
.sheet-center { text-align: center; }
.sheet-center .hanko { margin: 16px auto; }
.breakdown { margin-top: 16px; font-size: 14px; }
.breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--line-dash); font-variant-numeric: tabular-nums; }
.jirei-paper { position: relative; font-family: var(--font-serif); text-align: left; padding: 24px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 4px; margin-top: 12px; line-height: 2; box-shadow: var(--shadow-card); }
.jirei-paper .big { font-size: 26px; font-weight: 700; }
.paper-stamp { position: absolute; right: 16px; bottom: 16px; }
.shuntou-big { font-size: 40px; font-weight: 900; margin: 8px 0; }
.stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin: 14px 0 6px; }
.star { color: var(--line-strong); }
.star.on { color: var(--marker); animation: starPop 0.5s cubic-bezier(.2,1.8,.4,1) both; }
.star.on .star-fill path { stroke: var(--ink-strong); }
@keyframes starPop { 0% { transform: scale(0) rotate(-90deg); } 100% { transform: scale(1) rotate(0); } }
.result-msg { font-size: 20px; font-weight: 900; }
.achv-big { color: var(--panel-yellow); margin: 12px 0; }

/* 職場の地雷の判定（大炎上・炎上・くすぶり）はハンコで押す */
.fire-badge {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px auto 0; width: fit-content;
  font-family: var(--font-serif); font-size: 28px; font-weight: 700; color: var(--accent);
  border: 3px solid var(--accent); border-radius: 8px; padding: 4px 16px; transform: rotate(-4deg);
  animation: stamp 0.45s cubic-bezier(.2,1.6,.4,1) both;
}
.fire-badge.f-mid { color: var(--panel-red); border-color: var(--panel-red); }
.fire-badge.f-small { color: var(--panel-yellow); border-color: var(--panel-yellow); font-size: 22px; }

/* ---------- リアクション（カードを切った瞬間） ---------- */
.reaction {
  position: fixed; inset: 0; z-index: var(--z-overlay); display: flex; align-items: center; justify-content: center;
  background: rgb(27 29 36 / 0.4); padding: 16px; cursor: pointer;
}
.rx-rays { display: none; }
.rx-inner {
  position: relative; width: min(420px, 100%); text-align: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 26px 16px 20px;
  box-shadow: 0 10px 30px rgb(27 29 36 / 0.3);
}
.rx-inner::before {
  content: ""; position: absolute; top: -10px; left: 50%; width: 110px; height: 22px; translate: -50% 0;
  background: var(--tape); transform: rotate(-2deg);
}
.reaction.show .rx-inner { animation: popIn 0.35s cubic-bezier(.2,1.6,.4,1); }
@keyframes popIn { 0% { transform: scale(0.6) rotate(-4deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.rx-sfx {
  display: inline-block; font-size: 46px; font-weight: 900; line-height: 1.15; color: var(--accent); letter-spacing: 0.04em;
  transform: rotate(-6deg); background: linear-gradient(transparent 62%, var(--marker) 62%); padding: 0 6px;
}
.reaction.show .rx-sfx { animation: sfx 0.5s cubic-bezier(.2,1.8,.4,1); }
@keyframes sfx { 0% { transform: rotate(-6deg) scale(2.2); opacity: 0; } 100% { transform: rotate(-6deg) scale(1); opacity: 1; } }
.tone-bad .rx-sfx { color: var(--panel-red); background: none; }
.rx-card { margin-top: 12px; font-weight: 800; color: var(--ink-strong); }
.rx-text { margin-top: 4px; font-size: 15px; }
.rx-gains { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.gain { font-weight: 900; font-size: 16px; padding: 1px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; border: 1.5px solid; }
.gain.up { color: var(--up); background: var(--panel-green-weak); }
.gain.down { color: var(--down); background: var(--panel-red-weak); }
.reaction.show .gain { animation: floatUp 0.6s ease-out both; }
@keyframes floatUp { 0% { transform: translateY(14px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.rx-panel { margin-top: 12px; padding: 8px 12px; border-radius: 8px; font-weight: 900; border: 1.5px solid; }
.rx-panel span { font-weight: 500; font-size: 14px; color: var(--ink); }
.rx-panel.p-blue { background: var(--panel-blue-weak); border-color: var(--panel-blue); color: var(--panel-blue); }
.rx-panel.p-yellow { background: var(--panel-yellow-weak); border-color: var(--panel-yellow); color: var(--panel-yellow); }
.rx-panel.p-green { background: var(--panel-green-weak); border-color: var(--panel-green); color: var(--panel-green); }
.rx-panel.p-red { background: var(--panel-red-weak); border-color: var(--panel-red); color: var(--panel-red); }
.rx-panel.p-person { background: var(--panel-person-weak); border-color: var(--panel-person); color: var(--panel-person); }
.rx-panel.p-event, .rx-panel.p-goal, .rx-panel.p-white { background: var(--card); border-style: dashed; border-color: var(--ink-strong); color: var(--ink-strong); }
.rx-combo { margin-top: 10px; font-size: 28px; font-weight: 900; color: var(--accent); }
.rx-combo span { display: block; font-size: 12px; color: var(--ink-soft); }
.reaction.show .rx-combo { animation: lvl 0.6s 0.2s cubic-bezier(.2,1.8,.4,1) both; }
.rx-break { margin-top: 4px; font-size: 13px; color: var(--ink-soft); }
.rx-levelup { margin-top: 8px; font-size: 24px; font-weight: 900; color: var(--ink-strong); background: linear-gradient(transparent 60%, var(--marker) 60%); display: inline-block; padding: 0 6px; }
.reaction.show .rx-levelup { animation: lvl 0.7s 0.3s cubic-bezier(.2,1.8,.4,1) both; }
.rx-achv { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-weight: 900; background: var(--marker); color: var(--ink-strong); padding: 4px 14px; border-radius: 999px; }
.reaction.show .rx-achv { animation: lvl 0.6s 0.45s cubic-bezier(.2,1.8,.4,1) both; }
@keyframes lvl { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.rx-skip { margin-top: 12px; color: var(--ink-soft); }

.shake { animation: shake 0.45s; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }

/* 紙吹雪（紙片） */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-toast); overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 13px; border-radius: 1px; animation-name: fall; animation-timing-function: linear; animation-fill-mode: forwards; }
.confetti i.c0 { background: var(--accent); }
.confetti i.c1 { background: var(--marker); }
.confetti i.c2 { background: var(--panel-blue); }
.confetti i.c3 { background: var(--fusen-social); }
@keyframes fall { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(105vh) rotate(720deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(176px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  z-index: var(--z-toast); max-width: min(440px, calc(100% - 32px)); width: max-content;
  background: #2b2e35; color: #fff; padding: 11px 18px; border-radius: 11px; font-weight: 800; font-size: 14px; line-height: 1.6;
  opacity: 0; pointer-events: none; transition: 0.18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 入社画面 ---------- */
.hero { padding: 26px 0 18px; text-align: center; }
.hero h1 {
  display: inline-flex; align-items: center; justify-content: center;
  width: 150px; height: 150px; border-radius: 50%; border: 6px solid var(--accent); color: var(--accent);
  font-family: var(--font-serif); font-size: 52px; letter-spacing: 0.06em; transform: rotate(-8deg);
}
.hero p { margin-top: 18px; color: var(--ink-soft); text-align: left; }
.field { margin-top: 18px; }
.field label, .field legend { display: block; font-size: 14px; font-weight: 800; color: var(--ink-strong); margin-bottom: 8px; padding: 0; }
.field fieldset { border: 0; margin: 0; padding: 0; }
.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 2px solid var(--line-strong); border-radius: var(--radius-btn);
  background: #fdfcf9; color: var(--ink); font-weight: 700;
}
.input::placeholder { color: var(--ink-faint); opacity: 1; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  margin: 0; display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 4px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--card);
  font-size: 14px; font-weight: 800; cursor: pointer; text-align: center; line-height: 1.3;
}
.seg input:checked + label { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.industries { display: grid; gap: 8px; }
.ind { display: block; margin: 0; cursor: pointer; }
.ind input { position: absolute; opacity: 0; pointer-events: none; }
.ind-card { display: grid; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--card); border: 1.5px solid var(--line-strong); }
.ind input:checked + .ind-card { background: var(--accent-soft); border: 2.5px solid var(--accent); }
.ind input:focus-visible + .ind-card { outline: 3px solid var(--focus); outline-offset: 2px; }
.ind-name { font-size: 17px; font-weight: 900; color: var(--ink-strong); }
.ind-salary { font-size: 13px; font-weight: 800; color: var(--ink-strong); background: linear-gradient(transparent 62%, var(--marker) 62%); justify-self: start; padding: 0 3px; }
.ind-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ind-tags .chip { background: var(--card-sunken); color: var(--ink); }
.ind-traits { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.howto { margin-top: 22px; font-size: 14px; color: var(--ink-soft); padding-left: 1.4em; }
.howto li + li { margin-top: 4px; }
.goal { margin-top: 12px; font-size: 14px; }

@media (max-width: 380px) {
  .board { grid-auto-columns: 48px; }
  .pcard-name { font-size: 10.5px; }
  .pstat-value { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
