/* トレード道場の見た目。色は fx_tool/web（振り返りツール）と同じ紺×黄 */
:root {
  --bg: #f4f5f7; --card: #ffffff; --ink: #1d2433; --sub: #5d6678; --line: #e2e5eb;
  --navy: #1f2d4d; --accent: #f2b705; --plus: #1a7f5a; --minus: #c0392b; --bar: #c9d3e6;
  --up: #1a7f5a; --down: #c0392b; --grid: #e9ecf1; --sl: #c0392b; --tp: #1a7f5a; --entry: #5d6678;
  --btn-ink: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c; --card: #1b2029; --ink: #e8ebf0; --sub: #9aa3b2; --line: #2c3340;
    --navy: #9db4e8; --accent: #f2b705; --plus: #4cc38a; --minus: #ff7b6b; --bar: #34405a;
    --up: #4cc38a; --down: #ff7b6b; --grid: #232a35; --sl: #ff7b6b; --tp: #4cc38a; --entry: #9aa3b2;
    --btn-ink: #12151c;
  }
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo", sans-serif; line-height: 1.6;
  -webkit-text-size-adjust: 100%; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 32px; }
h1 { font-size: 1.45rem; margin: 8px 0 4px; color: var(--navy); }
h2 { font-size: 1.02rem; margin: 0 0 10px; color: var(--navy); }
.lead { color: var(--sub); margin: 0 0 16px; font-size: .95rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.safe { border-left: 4px solid var(--accent); font-size: .9rem; }
.disc-list { margin: 0; padding-left: 1.2em; }
.disc-list li { margin-bottom: 4px; }
.note { color: var(--sub); font-size: .84rem; margin: 6px 0; }
.err { color: var(--minus); font-size: .9rem; min-height: 1.3em; margin: 6px 0 0; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.row.center { justify-content: center; }

button { font: inherit; border: 0; border-radius: 8px; padding: 10px 18px; cursor: pointer; min-height: 44px;
  background: var(--navy); color: var(--btn-ink); touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
button.sub, button.ghost { background: transparent; color: var(--navy); border: 1px solid var(--navy); }
button.ghost { min-height: 34px; padding: 4px 10px; font-size: .82rem; border-color: var(--line); }
button.big { width: 100%; margin-top: 8px; font-weight: 700; }
button.buy { background: var(--plus); color: var(--btn-ink); flex: 1; font-weight: 700; font-size: 1.05rem; }
button.sell { background: var(--minus); color: var(--btn-ink); flex: 1; font-weight: 700; font-size: 1.05rem; }
button.close { background: var(--accent); color: #1d2433; flex: 1; font-weight: 700; font-size: 1.05rem; }
button.play { min-width: 112px; font-weight: 700; }
input[type=text], input[type=password], input[type=number], textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--ink); max-width: 100%; }
input[type=number] { width: 84px; }
textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .82rem; word-break: break-all; resize: vertical; }
#seedIn, #nickIn { width: 100%; }
.rules-list { margin: 4px 0 8px; padding-left: 1.2em; font-size: .86rem; }
.rules-list li { margin-bottom: 2px; }
.lbl { font-size: .86rem; }
#weekNew .lbl { display: block; margin-bottom: 4px; }
.done-msg { font-weight: 700; color: var(--navy); margin: 6px 0; }
.note.small { font-size: .76rem; }
.weekplay { font-size: .84rem; font-weight: 700; color: var(--navy); background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }

.top { background: var(--navy); }
.top-in { max-width: 860px; margin: 0 auto; padding: 6px 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .04em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #1b2029; border-bottom: 1px solid var(--line); } :root:not([data-theme="light"]) .brand { color: var(--navy); } }
.snd { display: flex; align-items: center; gap: 6px; }
.snd button.ghost { color: #fff; border-color: rgba(255,255,255,.4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .snd button.ghost { color: var(--ink); border-color: var(--line); } }
#vol { width: 90px; accent-color: var(--accent); }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modes .card { margin-bottom: 0; display: flex; flex-direction: column; }
.modes .card button.big { margin-top: auto; }
.modes { margin-bottom: 14px; }
@media (max-width: 640px) { .modes { grid-template-columns: 1fr; } }
.weekid { font-size: 1.15rem; font-weight: 700; margin: 4px 0; color: var(--navy); }
.howto ol, .howto ul { padding-left: 1.3em; margin: 0 0 12px; }
.howto li { margin-bottom: 6px; }

/* プレイ画面 */
.fict { font-size: .8rem; color: var(--sub); background: var(--card); border: 1px dashed var(--accent);
  border-radius: 8px; padding: 4px 10px; margin-bottom: 8px; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.st { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; min-width: 0; }
.st .k { display: block; font-size: .7rem; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st .v { display: block; font-size: 1.02rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.chartwrap { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
#chart { display: block; width: 100%; height: 340px; touch-action: manipulation; cursor: crosshair; }
@media (max-width: 560px) { #chart { height: 280px; } }
.toast { position: absolute; left: 50%; top: 34px; transform: translateX(-50%); background: var(--navy); color: var(--btn-ink);
  padding: 6px 14px; border-radius: 999px; font-size: .88rem; font-weight: 700; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 2px 8px rgba(0,0,0,.2); pointer-events: none; }
.ctrl { justify-content: flex-start; }
.seg { display: inline-flex; border: 1px solid var(--navy); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; color: var(--navy); border-radius: 0; padding: 8px 12px; min-width: 52px; }
.seg button.on { background: var(--navy); color: var(--btn-ink); }
.order .orow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 8px; }
.order .lbl { font-size: .86rem; color: var(--sub); min-width: 84px; }
.order .unit { font-size: .84rem; color: var(--sub); margin-right: 10px; }
#posInfo { font-variant-numeric: tabular-nums; }
.pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 12px; font-size: .9rem; }
.pos-grid .k { display: block; font-size: .72rem; color: var(--sub); }
@media (max-width: 560px) { .pos-grid { grid-template-columns: repeat(2, 1fr); } }
.plus { color: var(--plus); } .minus { color: var(--minus); }

/* 結果 */
.score-card { text-align: center; border-top: 4px solid var(--accent); }
.score-card .title { font-size: 1.1rem; color: var(--sub); }
.score-card .total { font-size: 3rem; font-weight: 800; color: var(--navy); line-height: 1.2; font-variant-numeric: tabular-nums; }
.score-card .reason { font-size: .9rem; color: var(--sub); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
th { color: var(--sub); font-weight: 500; font-size: .76rem; }
td.ok { color: var(--plus); } td.ng { color: var(--sub); }
tr.sum td { font-weight: 700; border-bottom: 0; }
.scrollx { overflow-x: auto; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.kv div { background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.kv .k { display: block; font-size: .72rem; color: var(--sub); }
.kv .v { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .kv { grid-template-columns: repeat(2, 1fr); } }

.foot { max-width: 860px; margin: 0 auto; padding: 12px 16px 32px; font-size: .74rem; color: var(--sub); border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }
.foot .credit { font-weight: 700; color: var(--navy); }

/* 週間ランキング */
select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); max-width: 100%; min-height: 40px; }
#rankNickIn { width: 100%; }
#rankNickBox .lbl { display: block; margin-bottom: 4px; }
table.rank td.rk { font-weight: 700; text-align: center; }
table.rank td.nk { word-break: break-all; }
table.rank tr.me td { background: rgba(242, 183, 5, .18); }
table.rank .you { font-size: .72rem; background: var(--accent); color: #1d2433; border-radius: 4px; padding: 0 4px; white-space: nowrap; }
@media (max-width: 560px) { table.rank .opt2 { display: none; } }
@media (max-width: 420px) { table.rank .opt { display: none; } table.rank { font-size: .82rem; } }

/* 管理画面 */
table.adm tr.off td { opacity: .5; }
table.adm td.nk { word-break: break-all; }
table.adm button { min-height: 34px; padding: 4px 10px; font-size: .82rem; white-space: nowrap; }
table.adm .flag { font-size: .72rem; background: #c0392b; color: #fff; border-radius: 4px; padding: 0 5px; white-space: nowrap; font-weight: bold; }
table.adm .flagwhy { font-size: .72rem; color: var(--sl); margin-top: 2px; }
