/* 男塾アプリの見た目（案E：手帳）。色・字・大きさは、いちばん上の :root だけ直せば全部に効く。
   決まりの正本は ブラックマン/DESIGN_ダークメン.md */
:root {
  --bg: #0a0a0c;      /* 地 */
  --panel: #131316;   /* 板 */
  --text: #f3f1ea;    /* 本文 */
  --sub: #b7b3a8;     /* 補足 */
  --gold: #c8a45d;    /* 数字・線・大事なボタン */
  --red: #d2353b;     /* 赤い箱（1画面に1か所まで） */
  --line: rgba(255, 255, 255, .1);
  --gline: rgba(200, 164, 93, .45);
  --mincho: "Shippori Mincho B1", "Hiragino Mincho ProN", serif;
  --gothic: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
  --num: "Cormorant Garamond", "Times New Roman", serif;
  --tabh: 68px;
  --safe: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--gothic); font-weight: 500; font-size: 16px; line-height: 1.8; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
#view { max-width: 480px; margin: 0 auto; padding: 20px 20px calc(var(--tabh) + var(--safe) + 32px); min-height: 100vh; }
#view.has-composer { padding-bottom: calc(var(--tabh) + var(--safe) + 150px); }
#view.no-tabs { padding-bottom: 48px; }
h1, h2, h3 { font-family: var(--mincho); font-weight: 800; margin: 0; line-height: 1.4; }
h1 { font-size: 32px; }
h2 { font-size: 26px; }
.num { font-family: var(--num); font-weight: 600; color: var(--gold); line-height: 1; font-variant-numeric: lining-nums; }
.sub { color: var(--sub); font-size: 14px; line-height: 1.7; }
.redbox { background: var(--red); color: #fff; font-weight: 900; border-radius: 4px; padding: 0 .28em; }
.rule { border: 0; border-top: 1px solid var(--gline); margin: 20px 0; }

/* ---- 上の行（日付・何日目） ---- */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.top .date { font-family: var(--mincho); font-weight: 800; font-size: 24px; }
.top .days { white-space: nowrap; font-size: 14px; font-weight: 700; }
.top .days .num { font-size: 36px; }
.top .days .slash { color: var(--gold); margin: 0 4px; }

/* ---- 7日のマス ---- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 18px; }
.week .cell { border: 1px solid var(--gline); border-radius: 8px; text-align: center; padding: 7px 0 6px; min-height: 76px; }
.week .wd { font-size: 14px; font-weight: 700; line-height: 1.2; }
.week .d { font-variant-numeric: lining-nums; font-family: var(--num); font-weight: 600; font-size: 27px; line-height: 1.15; color: var(--text); }
.week .ck { height: 12px; font-size: 12px; line-height: 12px; font-weight: 900; }
.week .cell.done { background: var(--gold); border-color: var(--gold); color: #0a0a0c; }
.week .cell.done .d { color: #0a0a0c; }
.week .cell.today { border: 2px solid var(--gold); }
.week .cell.today .d { color: var(--gold); }
.week .cell.done.today .d { color: #0a0a0c; }

/* ---- ダークメンから ---- */
.from { display: grid; grid-template-columns: 34% 1fr; background: var(--panel); border-radius: 10px; overflow: hidden; margin-bottom: 26px; min-height: 148px; }
.from .pic { position: relative; background: radial-gradient(120% 90% at 50% 100%, rgba(210, 53, 59, .22), transparent 70%); overflow: hidden; }
.from .pic img { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); height: calc(100% + 30px); width: auto; max-width: none; display: block; }
.from .txt { padding: 14px 16px 14px 14px; border-left: 1px solid var(--gline); margin: 12px 0; display: flex; flex-direction: column; justify-content: center; }
.from .who { color: var(--gold); font-weight: 900; font-size: 15px; line-height: 1.4; }
.from .when { color: var(--sub); font-size: 14px; margin-bottom: 6px; }
.from .say { font-weight: 900; font-size: 18px; line-height: 1.6; }
.from .go { color: var(--sub); font-size: 14px; margin-top: 6px; }

/* ---- 見出しの行 ---- */
.hrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hrow .count { font-weight: 700; font-size: 15px; white-space: nowrap; }

/* ---- 毎日の習慣 ---- */
.habits { margin-top: 10px; border-top: 1px solid var(--gline); }
.habit { border-bottom: 1px solid var(--line); }
.habit .row { display: flex; align-items: center; gap: 14px; min-height: 60px; width: 100%; text-align: left; }
.habit .box { flex: 0 0 30px; height: 30px; border: 1.5px solid var(--gold); border-radius: 6px; display: grid; place-items: center; color: transparent; font-weight: 900; font-size: 19px; line-height: 1; }
.habit.on .box { background: var(--gold); color: #0a0a0c; }
.habit .label { font-weight: 900; font-size: 18px; flex: 1; line-height: 1.4; }
.habit .hsub { color: var(--text); font-size: 15px; font-weight: 500; text-align: right; line-height: 1.4; }
.habit .more { flex: 0 0 44px; height: 60px; display: grid; place-items: center; color: var(--gold); font-size: 14px; }
.habit .detail { padding: 2px 0 16px 44px; font-size: 15px; line-height: 1.75; }
.habit .detail ul { margin: 0; padding: 0; list-style: none; }
.habit .detail li { padding: 6px 0; border-top: 1px solid var(--line); }
.habit .detail li b { font-weight: 900; }
.habit .detail li .n { color: var(--gold); font-weight: 900; margin-left: 8px; white-space: nowrap; }
.habit .detail li .how { display: block; color: var(--sub); font-size: 14px; }
.linkrow { text-align: right; margin: 10px 0 0; }
.link { font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; padding: 10px 0 10px 12px; display: inline-block; }

/* ---- 続いた日 ---- */
.streak { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-top: 1px solid var(--gline); margin-top: 14px; padding: 16px 0 18px; }
.streak .big { font-family: var(--mincho); font-weight: 800; font-size: 24px; }
.streak .big .num { font-size: 54px; margin-right: 6px; }

/* ---- ボタン ---- */
.btn { display: block; width: 100%; min-height: 60px; border-radius: 8px; font-weight: 900; font-size: 18px; text-align: center; padding: 10px 14px; line-height: 1.4; }
.btn.gold { background: var(--gold); color: #0a0a0c; }
.btn.line { border: 1.5px solid var(--gold); color: var(--gold); }
.btn.quiet { border: 1px solid var(--line); color: var(--text); font-size: 16px; min-height: 52px; }
.btn + .btn { margin-top: 12px; }

/* ---- 下のタブ ---- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--bg); border-top: 1px solid var(--gline); padding-bottom: var(--safe); }
.tabs .in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tabh); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--sub); font-weight: 700; font-size: 14px; line-height: 1.2; }
.tabs a svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--gold); }
.tabs.hide { display: none; }

/* ---- 講義 ---- */
.lhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--gline); padding-bottom: 10px; margin-bottom: 16px; position: relative; }
.lhead .seen { font-weight: 700; font-size: 15px; white-space: nowrap; }
.lhead .seen .num { font-size: 34px; }
.lhead .bar { position: absolute; left: 0; bottom: -1px; height: 3px; background: var(--gold); }
.next { background: var(--panel); border-radius: 10px; padding: 14px; margin-bottom: 18px; }
.chip { display: inline-block; border: 1px solid var(--gold); color: var(--gold); border-radius: 6px; font-size: 14px; font-weight: 900; padding: 1px 9px; line-height: 1.6; white-space: nowrap; }
.chip.fill { background: var(--gold); color: #0a0a0c; }
.chip.gray { border-color: var(--line); color: var(--sub); font-weight: 700; }
.thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; margin: 10px 0 12px; background: #000; border: 1px solid var(--gline); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; background: rgba(10, 10, 12, .82); border: 1.5px solid var(--gold); display: grid; place-items: center; }
.thumb .play::after { content: ""; border-left: 20px solid var(--text); border-top: 13px solid transparent; border-bottom: 13px solid transparent; margin-left: 6px; }
.thumb .soon { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(10, 10, 12, .85); color: var(--text); font-size: 14px; font-weight: 700; text-align: center; padding: 6px; }
.lno { font-family: var(--mincho); font-weight: 800; font-size: 26px; line-height: 1.2; }
.lno .num { font-size: 38px; margin-left: 4px; }
.ltitle { font-weight: 900; font-size: 19px; line-height: 1.55; margin: 6px 0 14px; }
.hint { font-size: 15px; line-height: 1.8; margin-top: 12px; }
.hint .sub { display: block; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--gline); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.seg button { min-height: 52px; font-weight: 900; font-size: 16px; color: var(--sub); border-bottom: 2px solid transparent; }
.seg button.on { color: var(--text); border-bottom-color: var(--gold); }
.segnote { margin: 8px 0 10px; }
.part { border-bottom: 1px solid var(--gline); }
.part .phead { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; text-align: left; }
.part .pname { font-family: var(--mincho); font-weight: 800; font-size: 20px; flex: 1; line-height: 1.35; }
.part .pcount { font-size: 14px; font-weight: 700; white-space: nowrap; }
.part .pcount .num { font-size: 22px; }
.part .chev { color: var(--gold); width: 22px; text-align: center; font-size: 14px; }
.part .move { display: flex; gap: 6px; }
.part .move button { width: 44px; height: 44px; border: 1px solid var(--gline); border-radius: 8px; color: var(--gold); font-size: 16px; }
.part .move button:disabled { opacity: .25; }
.lrow { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; }
.lrow .n { flex: 0 0 38px; font-variant-numeric: lining-nums; font-family: var(--num); font-weight: 600; font-size: 26px; color: var(--gold); line-height: 1; }
.lrow .t { flex: 1; font-weight: 700; font-size: 16px; line-height: 1.5; }
.lrow .t .chip { margin-top: 4px; font-size: 14px; }
.lrow .st { flex: 0 0 auto; color: var(--gold); font-weight: 900; font-size: 18px; min-width: 24px; text-align: right; }
.lrow.seen .t { color: var(--sub); }
.lrow.isnext { border: 1.5px solid var(--gold); border-radius: 8px; padding: 8px 10px; margin: 4px 0; }
.lrow.isnext + .lrow { border-top: 0; }
.foot { margin-top: 18px; }

/* ---- 講義を見る画面 ---- */
.back { display: inline-block; font-weight: 700; font-size: 15px; padding: 8px 0 12px; text-decoration: none; color: var(--sub); }
.block { border-top: 1px solid var(--gline); padding: 16px 0; }
.block h3 { font-size: 20px; margin-bottom: 8px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.6; font-weight: 700; }
.steps li:first-child { border-top: 0; }
.steps li::before { content: counter(s); font-variant-numeric: lining-nums; font-family: var(--num); font-weight: 600; font-size: 26px; color: var(--gold); line-height: 1.1; flex: 0 0 22px; }
.note { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 15px; line-height: 1.7; margin: 12px 0; }
.out { font-weight: 900; font-size: 18px; }

/* ---- 報告の部屋 ---- */
.rhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lead { font-weight: 700; font-size: 16px; line-height: 1.7; margin: 8px 0 2px; }
.card { background: var(--panel); border-radius: 10px; padding: 14px 16px 8px; margin-top: 12px; }
.card .chead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .av { flex: 0 0 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--sub); display: grid; place-items: center; font-weight: 900; font-size: 15px; line-height: 1; }
.card .nm { font-weight: 900; font-size: 17px; }
.card .dy { font-size: 14px; font-weight: 700; white-space: nowrap; }
.card .dy .num { font-size: 22px; }
.card .tm { font-variant-numeric: lining-nums; font-family: var(--num); font-weight: 600; font-size: 19px; color: var(--sub); margin-left: auto; }
.card .cfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.card .body { font-size: 17px; line-height: 1.75; font-weight: 700; margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.card .heart { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 44px; min-width: 64px; margin-left: auto; color: var(--sub); }
.card .heart svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linejoin: round; }
.card .heart .num { font-size: 22px; color: var(--sub); }
.card .heart.on { color: var(--gold); }
.card .heart.on svg { fill: var(--gold); }
.card .heart.on .num { color: var(--gold); }
.empty { border: 1px dashed var(--gline); border-radius: 10px; padding: 22px 16px; text-align: center; font-weight: 700; margin-top: 14px; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--tabh) + var(--safe)); z-index: 15; background: var(--bg); border-top: 1px solid var(--gline); }
.composer .in { max-width: 480px; margin: 0 auto; padding: 10px 20px 12px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.composer .lab { grid-column: 1 / -1; font-size: 14px; font-weight: 700; color: var(--gold); line-height: 1.4; }
.composer textarea { width: 100%; min-height: 60px; max-height: 160px; resize: none; background: var(--bg); border: 1px solid var(--sub); border-radius: 8px; padding: 10px 12px; font-size: 16px; line-height: 1.6; font-weight: 700; }
.composer textarea::placeholder { color: var(--sub); font-weight: 500; }
.composer textarea:focus, .field input:focus, .field select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.composer .btn { width: auto; min-width: 104px; padding: 10px 16px; }

/* ---- ダークメンの部屋 ---- */
.msg { max-width: 86%; border-radius: 10px; padding: 10px 14px; margin-top: 10px; font-size: 16px; line-height: 1.7; font-weight: 700; white-space: pre-wrap; word-break: break-word; }
.msg.me { margin-left: auto; background: var(--panel); border: 1px solid var(--gline); }
.msg.darkmen { background: var(--panel); }
.msg.system { max-width: 100%; background: none; border: 1px dashed var(--line); color: var(--sub); font-size: 14px; font-weight: 500; }
.msg .t { display: block; font-variant-numeric: lining-nums; font-family: var(--num); font-size: 15px; color: var(--sub); font-weight: 600; line-height: 1.2; margin-top: 4px; }

/* ---- 習慣を作る画面 ---- */
.field { margin-top: 18px; }
.field > label, .field > .lab { display: block; font-weight: 900; font-size: 16px; margin-bottom: 6px; }
.field input[type=text], .field select { width: 100%; min-height: 54px; background: var(--panel); border: 1px solid var(--gline); border-radius: 8px; padding: 8px 12px; font-size: 17px; font-weight: 700; -webkit-appearance: none; appearance: none; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.opt { display: flex; align-items: center; gap: 14px; min-height: 56px; border-bottom: 1px solid var(--line); font-weight: 900; font-size: 17px; line-height: 1.4; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt .box { flex: 0 0 30px; height: 30px; border: 1.5px solid var(--gold); border-radius: 6px; display: grid; place-items: center; color: transparent; font-weight: 900; font-size: 19px; line-height: 1; }
.opt input:checked + .box { background: var(--gold); color: #0a0a0c; }
.opt input:focus-visible + .box { outline: 2px solid var(--text); outline-offset: 2px; }
.opt small { display: block; color: var(--sub); font-size: 14px; font-weight: 500; }
.group { border-top: 1px solid var(--gline); margin-top: 26px; padding-top: 18px; }
.group h2 { font-size: 22px; }
.inner { padding: 4px 0 12px 44px; }
.addrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 10px; }
.addrow .btn { width: auto; min-height: 54px; padding: 8px 16px; font-size: 16px; }
.tools { margin-top: 40px; border-top: 1px dashed var(--line); padding-top: 16px; }

/* ---- 知らせ ---- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + var(--safe) + 20px); transform: translateX(-50%); background: var(--text); color: #0a0a0c; font-weight: 900; font-size: 15px; border-radius: 8px; padding: 10px 16px; z-index: 40; max-width: 88vw; opacity: 0; pointer-events: none; transition: opacity .2s; text-align: center; line-height: 1.5; }
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
