:root {
  color-scheme: light;
  --bg: #ffffff; --ink: #172b2a; --muted: #5e7068; --line: #e0e8e4;
  --green: #14664c; --mint: #e9f5ef; --notice: #eff7f3; --error: #94352e;
  --notice-line: #c9e1d5; --notice-ink: #325c4c; --input-line: #75867e;
  --hover: #f5f9f7; --surface: #f4f5f4; --error-bg: #fff5f3; --on-primary: #ffffff;
  --edge-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --edge-bottom: calc(max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)) + var(--tg-content-safe-area-inset-bottom, 0px));
  --edge-left: calc(max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px)) + var(--tg-content-safe-area-inset-left, 0px));
  --edge-right: calc(max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px)) + var(--tg-content-safe-area-inset-right, 0px));
  --nav-height: 77px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.5;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111b1a; --ink: #e5efeb; --muted: #a5b8ae; --line: #354b42;
  --green: #8dd8b2; --mint: #223d32; --notice: #1b3028; --error: #ffb4a8;
  --notice-line: #406450; --notice-ink: #b8dfcc; --input-line: #6c8f7e;
  --hover: #192a23; --surface: #1c2b25; --error-bg: #3b2321; --on-primary: #10271c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.header { min-height: 80px; border-bottom: 1px solid var(--line); padding: calc(16px + var(--edge-top)) max(36px, var(--edge-right)) 16px max(36px, var(--edge-left)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.primary-nav { display: flex; gap: 8px; }
.primary-nav button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 10px 18px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 14px; }
.primary-nav button:hover { background: var(--hover); color: var(--ink); }
.primary-nav button[aria-current="page"] { color: var(--green); background: var(--mint); font-weight: 650; }
.primary-nav button[aria-current="page"] svg { stroke-width: 2.4; }
.theme-switch { display: flex; padding: 4px; border: 1px solid var(--input-line); border-radius: 12px; gap: 4px; }
.theme-switch button { display: flex; align-items: center; justify-content: center; gap: 12px; flex: 1; border: 0; border-radius: 8px; background: transparent; color: var(--muted); min-height: 64px; padding: 12px; font-size: 16px; }
.theme-switch button:hover { color: var(--ink); background: var(--hover); }
.theme-switch button[aria-pressed="true"] { color: var(--green); background: var(--mint); font-weight: 650; box-shadow: inset 0 -2px var(--green); }
.theme-status { margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.settings-screen { max-width: 600px; }
.settings-section { border-top: 1px solid var(--line); padding: 24px 0; margin-top: 28px; }
.settings-section + .settings-section { margin-top: 8px; }
.settings-section h2 { font-size: 20px; margin: 0 0 8px; }
.settings-note { color: var(--muted); margin: 0 0 20px; }
.logout-button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 56px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: transparent; color: var(--error); text-align: left; }
.logout-button:hover { background: var(--error-bg); }
.brand { display: flex; align-items: center; gap: 24px; font-size: 22px; font-weight: 650; white-space: nowrap; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 11px); gap: 3px; }
.brand-mark i { width: 11px; height: 11px; background: var(--ink); border-radius: 50%; }
.quiet-button { display: inline-flex; gap: 12px; align-items: center; border: 0; background: transparent; min-height: 44px; font-size: 14px; padding: 8px; }
.quiet-button:hover { color: var(--green); text-decoration: underline; }
main { max-width: 1488px; margin: auto; padding: 44px max(64px, var(--edge-right)) calc(64px + var(--edge-bottom)) max(64px, var(--edge-left)); }
h1 { font-size: 36px; line-height: 1.2; letter-spacing: -.8px; margin: 0; font-weight: 700; }
.intro { color: var(--muted); margin: 14px 0 0; font-size: 18px; }
.entry { color: var(--muted); margin: 7px 0 0; font-size: 14px; }
.notice { display: flex; align-items: center; gap: 18px; padding: 16px 22px; margin: 30px 0 0; border: 1px solid var(--notice-line); border-radius: 8px; background: var(--notice); font-size: 15px; color: var(--notice-ink); }
.notice span { font-size: 24px; line-height: 1; color: var(--green); }
.workspace { display: grid; grid-template-columns: 46% 54%; }
.catalog { padding: 24px 36px 0 0; min-width: 0; }
.search { display: flex; gap: 12px; align-items: center; border: 1px solid var(--input-line); border-radius: 8px; height: 46px; padding: 0 14px; color: var(--muted); margin-bottom: 8px; }
.search svg { width: 21px; height: 21px; }
.search input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 15px; height: 36px; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.services { list-style: none; padding: 0; margin: 0; }
.service { width: 100%; display: flex; align-items: center; gap: 20px; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; min-height: 64px; position: relative; }
.service:hover { background: var(--hover); }
.service[aria-pressed="true"] { background: var(--mint); border-radius: 6px; border-bottom-color: transparent; }
.service[aria-pressed="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--green); border-radius: 4px 0 0 4px; }
.service .icon { width: 48px; flex-shrink: 0; text-align: center; font-size: 30px; line-height: 1.2; }
.service-copy { display: grid; gap: 2px; min-width: 0; }
.service-name { font-size: 16px; line-height: 1.25; font-weight: 650; }
.service-summary { font-size: 13px; color: var(--muted); }
.detail { border-left: 1px solid var(--line); padding: 68px 0 32px 36px; min-width: 0; }
.detail-head { display: flex; align-items: center; gap: 28px; }
.detail-icon { font-size: 60px; width: 116px; height: 116px; display: grid; place-items: center; flex-shrink: 0; border-radius: 50%; background: var(--notice); }
.detail h2 { font-size: 28px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.3px; }
.detail-summary { color: var(--muted); margin: 0; }
.planned { margin: 28px 0; padding-left: 22px; color: var(--muted); font-size: 15px; }
.planned li { padding: 3px 0; }
.availability { padding: 18px 20px; border-radius: 8px; background: var(--surface); font-size: 15px; }
.availability strong { display: block; font-weight: 600; margin-bottom: 5px; }
.availability p { margin: 0; color: var(--muted); }
.error, .availability .error { color: var(--error); background: var(--error-bg); padding: 14px 18px; border-radius: 8px; }
.empty { color: var(--muted); padding: 24px 12px; }
.gate { border-top: 1px solid var(--line); margin-top: 36px; padding: 32px 0; max-width: 600px; }
.gate h2 { font-size: 24px; line-height: 1.3; margin: 0 0 12px; }
.gate p { color: var(--muted); margin: 0 0 24px; }
.primary-button { border: 0; border-radius: 8px; padding: 12px 20px; min-height: 44px; background: var(--green); color: var(--on-primary); font-size: 15px; font-weight: 600; }
.back { display: none; }
.history { margin-top: 28px; }
.history h3 { margin-bottom: 8px; }
.history-note { color: var(--muted); font-size: 14px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-item { display: grid; gap: 4px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 12px 0; min-height: 48px; overflow-wrap: anywhere; }
.history-item:hover { color: var(--green); }
.history-item small { color: var(--muted); }
.history-controls { display: flex; flex-wrap: wrap; gap: 12px; }
.reading-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.reading-result h4 { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 900px) {
  main { padding: 32px max(32px, var(--edge-right)) calc(32px + var(--edge-bottom)) max(32px, var(--edge-left)); }
  .catalog { padding-right: 24px; }
  .detail { padding-left: 24px; }
  .detail-head { flex-direction: column; align-items: flex-start; gap: 20px; }
}
@media (max-width: 640px) {
  :root { scroll-padding-bottom: calc(var(--nav-height) + var(--edge-bottom) + 20px); }
  .header { padding: calc(16px + var(--edge-top)) max(20px, var(--edge-right)) 16px max(20px, var(--edge-left)); min-height: 60px; gap: 12px; }
  .brand { gap: 12px; font-size: 18px; }
  .primary-nav { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 10px max(20px, var(--edge-right)) calc(10px + var(--edge-bottom)) max(20px, var(--edge-left)); border-top: 1px solid var(--line); background: var(--bg); }
  .primary-nav button { flex-direction: column; gap: 4px; min-height: 56px; padding: 5px 8px; font-size: 13px; line-height: 1.3; }
  .primary-nav button svg { width: 22px; height: 22px; }
  .quiet-button { font-size: 14px; gap: 8px; line-height: 1.3; }
  .quiet-button svg { width: 20px; }
  main { padding: 24px max(20px, var(--edge-right)) calc(36px + var(--nav-height) + var(--edge-bottom)) max(20px, var(--edge-left)); }
  h1 { font-size: 30px; }
  .intro { font-size: 16px; }
  .notice { margin-top: 20px; padding: 12px 14px; font-size: 14px; align-items: flex-start; gap: 12px; }
  .workspace { display: block; }
  .catalog { padding: 20px 0 0; }
  .search input { font-size: 16px; }
  .service { gap: 12px; min-height: 70px; padding: 12px 8px; }
  .service .icon { width: 40px; font-size: 28px; }
  .service-name { font-size: 15px; }
  .service-summary { font-size: 13px; }
  .detail { border-left: 0; border-top: 1px solid var(--line); padding: 24px 0; margin-top: 24px; scroll-margin-top: 20px; }
  .detail-head { flex-direction: row; align-items: center; gap: 16px; }
  .detail-icon { width: 76px; height: 76px; font-size: 40px; }
  .detail h2 { font-size: 24px; }
  .detail-summary { font-size: 14px; }
  .back { display: inline-flex; margin: 0 0 20px; padding-left: 0; }
}
