:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f5f5f7; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { width: min(100%, 700px); margin: 0 auto; padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom)); }
.app-header, .chart-heading, .event-heading, .button-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.app-header { min-height: 3rem; margin: .1rem 0 1.5rem; }
.eyebrow { margin: 0 0 .25rem; color: #6e6e73; font-size: .68rem; font-weight: 600; letter-spacing: .09em; }.app-version { display: inline-block; margin-left: .25rem; padding: .14rem .38rem; color: #007aff; background: rgba(0, 122, 255, .1); border-radius: 999px; font-size: .6rem; letter-spacing: .04em; vertical-align: 1px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; color: #1d1d1f; font-size: clamp(2rem, 8vw, 2.65rem); font-weight: 700; letter-spacing: -.055em; line-height: .98; }
h2 { color: #1d1d1f; font-size: .95rem; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.status-badge { padding: .45rem .7rem; border-radius: 999px; background: rgba(118, 118, 128, .12); color: #3a3a3c; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.status-badge[data-state="ready"] { background: rgba(0, 122, 255, .1); color: #0071e3; }
.status-badge[data-state="active"] { background: rgba(255, 59, 48, .12); color: #d70015; }

.permission-panel { display: grid; grid-template-columns: auto 1fr; gap: .6rem .85rem; margin-bottom: 1.25rem; padding: 1.05rem; background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .05); }
.permission-panel h2 { margin: .15rem 0 .3rem; }
.permission-panel p { margin: 0; color: #6e6e73; font-size: .82rem; line-height: 1.5; }
.panel-icon { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; color: #fff; background: #007aff; font-size: 1.35rem; font-weight: 700; }
.permission-panel .button { grid-column: 1 / -1; margin-top: .2rem; }
.setup-panel, .summary-panel, .history-panel { margin-bottom: 1.25rem; padding: 1.05rem; background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.setup-panel h2 { margin: .15rem 0 .35rem; }.setup-panel p { margin-bottom: .9rem; color: #6e6e73; font-size: .82rem; line-height: 1.5; }.section-label { margin: 0 0 .25rem; color: #6e6e73; font-size: .65rem; font-weight: 650; letter-spacing: .09em; }.setup-meta { display: flex; justify-content: space-between; gap: .75rem; padding-top: .85rem; color: #6e6e73; font-size: .72rem; }.setup-meta span:first-child { color: #007aff; font-weight: 600; }
.live-panel { margin-bottom: 1.25rem; padding: 1.05rem; background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }.live-panel h2 { margin: .15rem 0 .35rem; }.live-panel > div > p:not(.section-label) { margin: 0 0 .85rem; color: #6e6e73; font-size: .8rem; line-height: 1.5; }.live-actions { display: flex; align-items: end; gap: .55rem; margin-top: .65rem; }.live-actions .button { flex: 1; }.live-actions label { display: grid; flex: 1; gap: .35rem; color: #3a3a3c; font-size: .72rem; }.live-actions input { min-height: 44px; padding: .55rem .7rem; color: #1d1d1f; background: #f5f5f7; border: 1px solid transparent; border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }.live-code { display: grid; place-items: center; min-width: 8.8rem; min-height: 44px; color: #007aff; background: rgba(0, 122, 255, .1); border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; font-weight: 700; letter-spacing: .1em; }.live-status { margin: .8rem 0 0; color: #6e6e73; font-size: .72rem; }.live-status.is-live { color: #007aff; font-weight: 600; }body[data-mode="monitor"] #permissionPanel, body[data-mode="monitor"] #setupPanel, body[data-mode="monitor"] #controlsPanel, body[data-mode="monitor"] #summaryPanel, body[data-mode="monitor"] #historyPanel { display: none; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: 0 0 1.25rem; }
.metric-card { min-height: 6.75rem; padding: .85rem .72rem; background: #fff; border-radius: 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.metric-card span, .metric-card small { display: block; color: #6e6e73; font-size: .68rem; line-height: 1.15; }
.metric-card strong { display: block; margin: .53rem 0 .25rem; color: #1d1d1f; font-size: clamp(1.15rem, 4.8vw, 1.65rem); font-weight: 650; letter-spacing: -.06em; line-height: 1; }
.accent-cyan, .accent-lime, .accent-coral, .accent-violet { color: inherit; }

.chart-stack { display: grid; gap: .8rem; }
.chart-card { padding: 1rem; background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.chart-heading span, .event-heading span { color: #6e6e73; font-size: .72rem; }
canvas { display: block; width: 100%; height: 145px; margin-top: .8rem; }
.legend { display: flex; gap: 1rem; margin-top: .45rem; color: #6e6e73; font-size: .71rem; }
.legend span::before { content: ""; display: inline-block; width: .42rem; height: .42rem; margin-right: .28rem; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.cyan-dot, .coral-dot { color: #007aff; }.lime-dot, .violet-dot { color: #6e6e73; }.impact-dot { color: #ff9500; }

.controls { margin-top: .8rem; padding: 1rem; background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.timer span { color: #6e6e73; font-size: .66rem; font-weight: 600; letter-spacing: .08em; }.timer strong { display: block; margin-top: .12rem; color: #1d1d1f; font-size: 1.8rem; font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.045em; }.timer small { display: block; margin-top: .3rem; color: #6e6e73; font-size: .66rem; line-height: 1.4; }
.button-row { align-items: stretch; margin: 1rem 0; }.button { min-height: 44px; border: 0; border-radius: 12px; padding: .7rem 1rem; font-weight: 600; cursor: pointer; transition: transform 180ms ease, opacity 180ms ease, background-color 180ms ease; }.button:active:not(:disabled) { transform: scale(.98); }.button:focus-visible { outline: 3px solid rgba(0, 122, 255, .35); outline-offset: 2px; }.button:disabled { cursor: not-allowed; opacity: .42; }
.button-primary, .button-record { color: #fff; background: #007aff; }.button-record.is-recording { background: #ff3b30; }.button-secondary { color: #007aff; background: rgba(0, 122, 255, .1); }.button-row .button { flex: 1; }
.threshold-control { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .65rem; color: #3a3a3c; font-size: .76rem; }.threshold-control input { min-width: 0; accent-color: #007aff; }.threshold-control output { color: #007aff; font-size: .74rem; font-variant-numeric: tabular-nums; }
.session-name { display: grid; gap: .45rem; margin-top: 1rem; color: #3a3a3c; font-size: .76rem; }.session-name input, .session-name select { width: 100%; min-height: 44px; padding: .6rem .75rem; color: #1d1d1f; background: #f5f5f7; border: 1px solid transparent; border-radius: 10px; outline: none; }.session-name input:focus, .session-name select:focus { border-color: #007aff; background: #fff; box-shadow: 0 0 0 3px rgba(0, 122, 255, .14); }
.event-panel { margin-top: .8rem; padding: 1rem; background: #fff; border-radius: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }.event-list { display: grid; gap: .5rem; max-height: 8.5rem; overflow: auto; padding: .75rem 0 0 1.4rem; margin: 0; }.event-list li { color: #3a3a3c; font-size: .8rem; }.empty-event { color: #6e6e73 !important; line-height: 1.5; }.event-time { color: #007aff; font-variant-numeric: tabular-nums; font-weight: 600; }
.summary-panel { margin-top: .8rem; }.summary-panel .event-heading { align-items: flex-start; }.summary-panel .section-label, .history-panel .section-label { margin-bottom: .3rem; }.summary-panel h2, .history-panel h2 { margin: 0; }.summary-panel > .event-heading > strong { display: grid; place-items: center; width: 3rem; height: 3rem; color: #fff; background: #007aff; border-radius: 50%; font-size: 1.25rem; font-variant-numeric: tabular-nums; }.summary-message { margin: .9rem 0; color: #3a3a3c; font-size: .86rem; line-height: 1.55; }.summary-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }.summary-metrics span { padding: .65rem .45rem; color: #6e6e73; background: #f5f5f7; border-radius: 10px; font-size: .65rem; line-height: 1.4; }.summary-metrics strong { display: block; color: #1d1d1f; font-size: .85rem; }.disclaimer { margin: .85rem 0 0; color: #86868b; font-size: .67rem; line-height: 1.45; }
.advice-action { margin-top: 1rem; }.advice-action .button { width: 100%; }.advice-action p { margin: .55rem 0 0; color: #6e6e73; font-size: .68rem; line-height: 1.45; }.advice-result { margin-top: .8rem; padding: .9rem; background: #f5f5f7; border-radius: 12px; }.advice-result h3 { margin: .1rem 0 .55rem; color: #1d1d1f; font-size: 1rem; letter-spacing: -.02em; }.advice-result p { margin: .55rem 0; color: #3a3a3c; font-size: .81rem; line-height: 1.55; }.advice-result p strong, .advice-result p span { display: block; }.advice-result p strong { color: #007aff; font-size: .7rem; }.advice-evidence, .advice-drill { padding: .65rem .7rem; border-radius: 9px; }.advice-evidence { background: rgba(90, 200, 250, .14); }.advice-drill { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }.advice-cue { padding: .55rem .7rem; color: #007aff !important; background: rgba(0, 122, 255, .1); border-radius: 8px; font-weight: 600; }.advice-caution { color: #6e6e73 !important; font-size: .7rem !important; }
.reading-guide { margin-top: 1rem; padding: .9rem; background: #f5f5f7; border-radius: 12px; }.reading-guide h3 { margin: .1rem 0 .7rem; color: #1d1d1f; font-size: .95rem; letter-spacing: -.01em; }.reading-guide ol { display: grid; gap: .65rem; padding: 0; margin: 0; list-style: none; counter-reset: results; }.reading-guide li { display: grid; grid-template-columns: 1fr; gap: .15rem; color: #3a3a3c; font-size: .77rem; line-height: 1.5; }.reading-guide li strong { color: #007aff; font-size: .74rem; }.reading-guide li span, .comparison-note { color: #6e6e73; }.comparison-note { margin: .8rem 0 0; padding-top: .7rem; border-top: 1px solid #d2d2d7; font-size: .7rem; line-height: 1.5; }
.history-panel { margin-top: .8rem; }.text-button { min-height: 36px; padding: .3rem .15rem; color: #007aff; background: transparent; border: 0; font-size: .75rem; }.history-list { display: grid; gap: 0; padding: .7rem 0 0; margin: 0; list-style: none; }.history-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-top: 1px solid #e5e5ea; }.history-list li:first-child { border-top: 0; }.history-list strong, .history-list small { display: block; }.history-list strong { color: #1d1d1f; font-size: .82rem; font-weight: 600; }.history-list small { margin-top: .12rem; color: #6e6e73; font-size: .7rem; }.history-list b { display: grid; place-items: center; min-width: 2rem; height: 2rem; color: #007aff; background: rgba(0, 122, 255, .1); border-radius: 50%; font-size: .78rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
@media (max-width: 430px) { .app-shell { padding-left: .75rem; padding-right: .75rem; }.metrics { gap: .45rem; }.metric-card { min-height: 6.55rem; padding: .75rem .45rem; }.metric-card span, .metric-card small { font-size: .61rem; }.live-actions { align-items: stretch; flex-direction: column; }.live-actions .button, .live-actions label { width: 100%; }.live-code { width: 100%; }.threshold-control { grid-template-columns: 1fr auto; }.threshold-control input { grid-column: 1 / -1; grid-row: 2; }.permission-panel, .setup-panel, .summary-panel, .history-panel, .live-panel { padding: .9rem; }.summary-metrics { gap: .35rem; }.summary-metrics span { padding: .55rem .35rem; font-size: .6rem; } }
