/* みちくさ App：雜誌編排方向。明朝體標題、全直角、強調色只給可以點的東西，畫重點用黃色標示色 */
:root {
  --bg: #F6F4EE; --surface: #FFFFFF; --sunk: #ECE8DF; --ink: #23211E; --muted: #6C675F; --accent: #2E5B4B; --on-accent: #F6F4EE; --mark: #F1DE8A; --desk: #E4E0D6; --new: #B8432F;
  --ja: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --zh: "Noto Serif TC", "PMingLiU", "Songti TC", serif;
  --ui: "Zen Kaku Gothic New", "Hiragino Sans", "Microsoft JhengHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #161715; --surface: #1F201D; --sunk: #2A2B27; --ink: #ECE9E2; --muted: #A29E95; --accent: #8FC3AD; --on-accent: #12201A; --mark: #6B5A1E; --desk: #0E0F0D; --new: #E58A74; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #161715; --surface: #1F201D; --sunk: #2A2B27; --ink: #ECE9E2; --muted: #A29E95; --accent: #8FC3AD; --on-accent: #12201A; --mark: #6B5A1E; --desk: #0E0F0D; --new: #E58A74; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--desk); color: var(--ink); font-family: var(--ui); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
.app { position: relative; height: 100%; max-width: 560px; margin: 0 auto; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.screen { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: calc(18px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 28px max(20px, env(safe-area-inset-left, 0px)); }
.view[hidden] { display: none; }

/* 刊頭與分頁標題 */
.mast { padding-top: 40px; margin-bottom: 22px; }
.kicker { margin: 0 0 6px; font-size: 12px; letter-spacing: .2em; color: var(--muted); }
.mast h1 { margin: 0; font-family: var(--ja); font-weight: 600; font-size: 56px; line-height: 1; letter-spacing: -.02em; }
.vh { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 26px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.vh h2 { font-family: var(--ja); font-weight: 600; font-size: 30px; letter-spacing: -.02em; line-height: 1.15; margin: 0; }
.vh small { font-size: 12px; color: var(--muted); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.view > .vh:first-child { margin-top: 30px; }

/* 接著讀 */
.resume { display: grid; grid-template-columns: 62px 1fr; gap: 14px; align-items: center; background: var(--surface); padding: 12px; text-decoration: none; color: var(--ink); }
.resume img { width: 62px; height: 82px; object-fit: cover; display: block; }
.resume small { display: block; font-size: 11px; letter-spacing: .18em; color: var(--accent); }
.resume b { font-family: var(--ja); font-weight: 600; font-size: 17px; display: block; margin: 2px 0; }
.resume span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.resume .bar { height: 3px; background: var(--sunk); margin-top: 8px; }
.resume .bar i { display: block; height: 100%; background: var(--accent); }
.resume:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 書架 */
.shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 14px; }
.issue { color: inherit; text-decoration: none; display: block; position: relative; }
.issue:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cv { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--c, #8a8170); color: #fff; }
.cv img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cv::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.45), transparent 40%); }
.cv .mh { position: absolute; z-index: 1; left: 9px; right: 9px; top: 7px; font-family: var(--ja); font-weight: 600; font-size: 16px; border-bottom: 1px solid rgba(255,255,255,.7); display: flex; justify-content: space-between; }
.cv .mh small { font-family: var(--ui); font-size: 9px; letter-spacing: .1em; align-self: center; }
.cv .vt { position: absolute; z-index: 1; right: 10px; top: 36px; writing-mode: vertical-rl; font-family: var(--ja); font-weight: 600; font-size: 16px; letter-spacing: .12em; line-height: 1.3; }
.issue.soon .cv { filter: saturate(.75); }
.issue.soon .cv::after { background: repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 10px, transparent 10px 20px); }
.issue .new { position: absolute; z-index: 2; top: -6px; left: -4px; background: var(--new); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .14em; padding: 2px 7px; }
.issue .meta { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.issue .meta b { display: block; font-family: var(--ja); font-weight: 600; font-size: 14px; color: var(--ink); }
.issue .meta .dt { font-variant-numeric: tabular-nums; }
.dl { margin-top: 6px; font-size: 11px; color: var(--accent); background: none; border: 1px solid var(--accent); padding: 3px 9px; cursor: pointer; }
.dl:disabled { color: var(--muted); border-color: var(--sunk); cursor: default; }
.dl:focus-visible, .chip:focus-visible, .cta:focus-visible, .play:focus-visible, .tg:focus-visible, .btn:focus-visible, .x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 切り抜き帳 */
.cta { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--accent); color: var(--on-accent); border: 0; padding: 14px 16px; font-size: 15px; font-weight: 700; cursor: pointer; margin-bottom: 16px; text-align: left; }
.cta small { font-weight: 400; font-size: 12px; opacity: .85; }
.chips { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.chip { font-size: 12px; background: var(--surface); border: 0; padding: 6px 12px; cursor: pointer; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.clips { display: grid; gap: 12px; }
.clip { background: var(--surface); border-top: 3px solid var(--ink); padding: 14px; display: grid; grid-template-columns: 76px 1fr; gap: 12px; }
.clip img, .clip .noimg { width: 76px; height: 76px; object-fit: cover; display: block; background: var(--sunk); }
.clip > div { min-width: 0; }
.clip .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.clip .w { font-family: var(--ja); font-weight: 600; font-size: 21px; letter-spacing: -.01em; }
.clip .rd { font-size: 11px; color: var(--muted); margin-left: 6px; font-weight: 400; font-family: var(--ui); letter-spacing: 0; }
.clip .mn { font-family: var(--zh); font-size: 13px; margin: 2px 0 6px; }
.clip .sent { font-family: var(--ja); font-size: 14px; line-height: 1.8; color: var(--muted); margin: 0; }
mark { background: linear-gradient(transparent 58%, var(--mark) 58%); color: var(--ink); padding: 0 1px; }
.clip .foot2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.clip .src { font-size: 11px; color: var(--accent); letter-spacing: .06em; font-variant-numeric: tabular-nums; text-decoration: none; }
.clip .src:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.x { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 4px 0; }
.empty { background: var(--surface); padding: 22px 18px; }
.empty b { display: block; font-family: var(--ja); font-weight: 600; font-size: 19px; margin-bottom: 8px; }
.empty p { margin: 0 0 14px; font-family: var(--zh); font-size: 14px; line-height: 1.9; color: var(--muted); }
.empty .demo { font-family: var(--ja); font-size: 15px; color: var(--ink); background: var(--sunk); padding: 10px 12px; margin: 0 0 14px; }
.empty .demo .w { border-bottom: 1px dashed var(--muted); }

.play { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.play svg { width: 11px; height: 11px; fill: currentColor; margin-left: 2px; }
.play.on { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); }

/* 付録 */
.card { background: var(--surface); margin-bottom: 16px; }
.card .hd { padding: 16px 16px 12px; background: var(--sunk); display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.card .hd small { font-size: 11px; letter-spacing: .14em; color: var(--muted); display: block; font-variant-numeric: tabular-nums; }
.card .hd b { font-family: var(--ja); font-weight: 600; font-size: 20px; letter-spacing: -.01em; }
.card .hd span { font-size: 11px; color: var(--muted); }
.card ul { list-style: none; margin: 0; padding: 6px 16px 10px; }
.card li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 11px 0; }
.card li + li { background: linear-gradient(var(--sunk), var(--sunk)) top / 100% 1px no-repeat; }
.card .jp { font-family: var(--ja); font-size: 17px; line-height: 1.5; }
.card .kn { font-size: 11px; color: var(--muted); display: block; }
.card .zh { font-family: var(--zh); font-size: 12px; color: var(--muted); display: block; }
.card.locked { opacity: .6; }
.card.locked p { margin: 0; padding: 14px 16px 16px; font-family: var(--zh); font-size: 13px; color: var(--muted); }

/* わたし */
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat div { background: var(--surface); padding: 12px; }
.stat b { display: block; font-family: var(--ja); font-weight: 600; font-size: 28px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.ttl { font-size: 11px; color: var(--muted); letter-spacing: .18em; margin: 24px 0 8px; }
.rows { background: var(--surface); padding: 4px 16px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; font-size: 14px; }
.row + .row { background: linear-gradient(var(--sunk), var(--sunk)) top / 100% 1px no-repeat; }
.row > span { min-width: 0; }
.row small { display: block; font-size: 11px; color: var(--muted); line-height: 1.6; margin-top: 2px; }
.tg { width: 44px; height: 26px; border: 0; background: var(--sunk); position: relative; cursor: pointer; flex: none; padding: 0; }
.tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: var(--surface); transition: transform .2s cubic-bezier(.2,.7,.2,1); }
.tg[aria-checked="true"] { background: var(--accent); }
.tg[aria-checked="true"]::after { transform: translateX(18px); }
.code { font-family: var(--ja); font-weight: 600; font-size: 22px; letter-spacing: .08em; font-variant-numeric: tabular-nums; user-select: all; }
.btn { background: none; border: 1px solid var(--accent); color: var(--accent); font-size: 13px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn.pri { background: var(--accent); color: var(--on-accent); }
.btn:disabled { opacity: .5; cursor: default; }
.join { display: flex; gap: 8px; margin-top: 8px; }
.join input { flex: 1; min-width: 0; font: 600 16px var(--ui); letter-spacing: .08em; text-transform: uppercase; padding: 8px 10px; border: 1px solid var(--muted); background: var(--bg); color: var(--ink); border-radius: 0; }
.join input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.foot { font-size: 11px; color: var(--muted); line-height: 1.8; margin: 26px 0 0; }

/* 底部分頁 */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); }
.tab { all: unset; cursor: pointer; text-align: center; padding: 8px 0 6px; font-size: 11px; color: var(--muted); position: relative; }
.tab b { display: block; font-family: var(--ja); font-weight: 600; font-size: 17px; line-height: 1.25; }
.tab[aria-selected="true"] { color: var(--accent); }
.tab[aria-selected="true"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; background: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tab .badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--new); color: #fff; font: 700 10px/16px var(--ui); font-variant-numeric: tabular-nums; }

/* 翻開複習 */
.rv { position: absolute; inset: 0; z-index: 5; background: var(--bg); display: flex; flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
.rv[hidden] { display: none; }
.rv .tp { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rv .x { color: var(--ink); font-size: 14px; }
.rv .dots { display: flex; gap: 4px; flex: 1; justify-content: center; }
.rv .dots i { width: 16px; height: 3px; background: var(--sunk); }
.rv .dots i.on { background: var(--accent); }
.rv .pic { margin-top: 16px; aspect-ratio: 4 / 3; max-height: 38vh; width: 100%; overflow: hidden; background: var(--sunk); }
.rv .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rv .src { font-size: 11px; color: var(--muted); letter-spacing: .06em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.rv .q { font-family: var(--ja); font-size: 21px; line-height: 1.9; margin: 14px 0 6px; }
.rv .blank { display: inline-block; min-width: 4.5em; border-bottom: 2px solid var(--ink); text-align: center; color: transparent; }
.rv .blank.open { color: var(--ink); background: linear-gradient(transparent 60%, var(--mark) 60%); border-color: transparent; }
.rv .hint { font-family: var(--zh); font-size: 14px; color: var(--muted); margin: 0; min-height: 2.6em; display: flex; align-items: center; gap: 10px; }
.rv .act { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 14px; }
.rv .act button { font-size: 15px; font-weight: 700; padding: 14px; border: 1px solid var(--accent); background: none; color: var(--accent); cursor: pointer; }
.rv .act button.pri { background: var(--accent); color: var(--on-accent); }
.rv .act .wide { grid-column: 1 / -1; }
.rv .act button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rv .done { margin: auto 0; }
.rv .done b { display: block; font-family: var(--ja); font-weight: 600; font-size: 28px; letter-spacing: -.02em; margin-bottom: 8px; }
.rv .done span { font-family: var(--zh); font-size: 14px; color: var(--muted); line-height: 1.9; }

.toast { position: absolute; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 9; background: var(--ink); color: var(--bg); font-size: 13px; padding: 9px 14px; max-width: calc(100% - 40px); }
.toast[hidden] { display: none; }

@media (min-width: 600px) { .app { border-left: 1px solid var(--sunk); border-right: 1px solid var(--sunk); } .shelf { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) { .tg::after { transition: none; } }
