:root {
  --navy: #1b2a4a;
  --gold: #c9a24b;
  --buy: #2e8b57;
  --sell: #c0504d;
  --ink: #23232b;
  --muted: #8a8a92;
  --line: #e6e4de;
  --card: #fff;
  --bg: #f6f5f2;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.hidden { display: none !important; }

.screen { max-width: 560px; margin: 0 auto; padding: 20px 16px 24px; }

h1 { font-size: 1.4rem; color: var(--navy); margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}

label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--navy); font-weight: 600; }
select, input[type=number] {
  display: block; width: 100%; margin-top: 5px; padding: 11px 10px;
  min-height: 44px; /* スマホで指が当たる最小サイズ */
  font-size: 16px; /* 16px未満だとiPhoneが勝手に拡大する */
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}

button { font-family: inherit; font-size: 15px; border-radius: 8px; cursor: pointer; }
.primary { background: var(--navy); color: #fff; border: none; padding: 13px 20px; font-weight: 600; }
.primary:disabled { background: #b9bdc9; }
.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); padding: 12px 16px; }
.wide { display: block; width: 100%; margin-top: 8px; }
.small { padding: 6px 12px; font-size: 13px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.resume { border-color: var(--gold); background: #fdfaf2; }
.resume p { margin: 0 0 12px; font-size: 14px; }

footer.note { font-size: 12px; line-height: 1.7; color: var(--muted); }
footer.note p { margin: 2px 0; }

/* ===== プレイ画面 ===== */
#play { padding-bottom: 96px; } /* 下の固定ボタンに隠れないよう空ける */

.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.day { font-size: 13px; color: var(--muted); }
.price { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1.2; }

#chart { width: 100%; height: 180px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }

.pos-area { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pos-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-size: 13px; text-align: left;
}
.pos-chip .pnl { font-weight: 700; margin-left: 6px; }
.pos-chip.long { border-left: 4px solid var(--buy); }
.pos-chip.short { border-left: 4px solid var(--sell); }
.plus { color: var(--buy); }
.minus { color: var(--sell); }
.pos-empty { color: var(--muted); font-size: 13px; }

.sheet-wrap { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sheet-title { padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--navy); border-bottom: 1px solid var(--line); }
.sheet { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheet th { background: #faf9f6; color: var(--muted); font-weight: 600; padding: 7px 8px; text-align: left; position: sticky; top: 0; }
.sheet td { padding: 7px 8px; border-top: 1px solid #f0eeea; }
.sheet td:nth-child(2), .sheet td:nth-child(4) { text-align: right; }
.sheet tr.today td { background: #fdfaf2; font-weight: 600; }
.sheet .strike { text-decoration: line-through; color: var(--muted); }
.sheet-scroll { max-height: 240px; overflow-y: auto; }

.pnl-bar { display: flex; gap: 16px; padding: 10px 2px; font-size: 13px; color: var(--muted); }
.pnl-bar b { color: var(--ink); }

.actions {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(246,245,242,0.96); border-top: 1px solid var(--line);
}
.act { flex: 1; border: none; padding: 16px 4px; font-size: 17px; font-weight: 700; color: #fff; }
.act.buy { background: var(--buy); }
.act.sell { background: var(--sell); }
.act.pass { background: #6f7583; font-size: 15px; }
.act:active { opacity: 0.8; }

/* ===== 入力シート ===== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: flex-end; z-index: 10; }
.modal-box {
  background: #fff; width: 100%; max-height: 88vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.modal-head h3 { margin: 0; font-size: 1.05rem; color: var(--navy); }
.q { font-size: 13px; font-weight: 600; color: var(--navy); margin: 14px 0 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 10px 14px; font-size: 14px;
}
.opt.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.exit-custom { margin-top: 8px; }

/* ===== 終了画面 ===== */
.stat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.stat b { font-size: 15px; }
#summaryBody { margin-bottom: 20px; }
.reveal { color: var(--muted); font-size: 13px; margin: 12px 0; }

/* Lucideアイコン（インラインSVG）。文字と同じ色・同じ行に載るようにする */
.icon { flex: 0 0 auto; vertical-align: -2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* アイコンだけのボタンは文字のボタンより低くなるので、指で押せる44pxを別途確保する */
.modal-head .ghost {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
}

/* 「終わる」は押すと練習が終わるので、誤タップしない大きさにする */
#quitBtn { min-height: 44px; min-width: 44px; }
