/*
 * 録音ノート（面談システム mendan の見た目を引き継ぐ）。
 * 色は6つだけ。実（berry）は「その画面で次に押すボタン1つ」と「録音中」にしか使わない。
 */
:root {
    color-scheme: light;   /* Android Chrome の自動ダーク化で日付・選択欄が黒くならないように */
    --ink: #23302B;        /* 墨：文字 */
    --ink-soft: #4E5B55;   /* 墨（淡）：補足の文字。和紙の上で約 6.9:1 */
    --paper: #F6F7F4;      /* 和紙：画面の地 */
    --rule: #D5DCD6;       /* 罫：区切り線 */
    --line: #7C8A83;       /* 入力欄の枠・未来の節（白の上で約 3.6:1） */
    --leaf: #3C6E5A;       /* 若竹：いまの段階・リンク・二番目の強調 */
    --leaf-dark: #2E5646;
    --mist: #EAF1EC;       /* 淡：③ 録音のあと */
    --berry: #B3263E;      /* 実：主ボタンと録音中だけ */
    --berry-dark: #931D32;
    --white: #FFFFFF;
    --font: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 18px;
    line-height: 1.8;
    color: var(--ink);
    background: var(--paper);
}
[hidden] { display: none !important; } /* .btn の display が hidden 属性に勝たないように */

h1, h2, h3 { line-height: 1.5; font-weight: 700; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 19px; }
p { margin: 0 0 12px; }

a, button, summary, label { -webkit-tap-highlight-color: transparent; }
a { color: var(--leaf); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--leaf-dark); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--leaf); outline-offset: 2px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.recording-date, .table, .row-meta, #recorder { font-variant-numeric: tabular-nums; }

/* ---- 上の帯 ---- */
.site-header { background: var(--white); border-bottom: 1px solid var(--rule); }
.site-header-inner {
    max-width: 720px; margin: 0 auto; padding: 0 16px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; min-height: 64px;
}
.site-name { font-weight: 700; font-size: 18px; color: var(--ink-soft); margin-right: 4px; }
.site-nav { display: flex; flex: 1 1 auto; }
.nav-link {
    display: flex; align-items: center; min-height: 64px; padding: 0 12px;
    color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 700;
    border-bottom: 3px solid transparent;
}
.nav-link:hover { color: var(--leaf); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--leaf); border-bottom-color: var(--leaf); }
.nav-link:focus-visible { outline-offset: -2px; }
.site-user { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--ink-soft); font-size: 16px; }
.site-user form { margin: 0; }
.btn-quiet {
    min-height: 44px; padding: 0 12px; background: none; border: 0; border-radius: 6px;
    font: inherit; font-size: 16px; color: var(--leaf); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.btn-quiet:hover { background: var(--mist); }

/* ---- 本文 ---- */
.container { max-width: 720px; margin: 0 auto; padding: 40px 16px 96px; }
.back-link { margin: 0 0 8px; font-size: 17px; }
.lead { color: var(--ink-soft); margin: 8px 0 0; }

/* 区切りは罫と余白で（白い箱と影は使わない） */
.section { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--rule); }
.section > h2 { margin-bottom: 16px; }

.notice { margin: 24px 0; padding: 12px 16px; background: var(--mist); border-left: 4px solid var(--leaf); }
.error { margin: 24px 0; padding: 12px 16px; background: var(--white); border-left: 4px solid var(--ink); font-weight: 700; }
.error:empty { display: none; }
.empty { color: var(--ink-soft); }

/* ---- ボタン ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 52px; padding: 10px 24px;
    border: 2px solid var(--leaf); border-radius: 6px;
    background: var(--white); color: var(--leaf);
    font: inherit; font-size: 18px; font-weight: 700; line-height: 1.4;
    text-align: center; text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--mist); color: var(--leaf-dark); text-decoration: none; }
.btn-primary { background: var(--berry); border-color: var(--berry); color: var(--white); }
.btn-primary:hover { background: var(--berry-dark); border-color: var(--berry-dark); color: var(--white); }
.btn-large { min-height: 60px; padding: 14px 28px; font-size: 20px; }
.btn-block { display: flex; width: 100%; }
.btn-danger { background: var(--white); border-color: var(--berry); color: var(--berry); }
.btn-danger:hover { background: var(--white); color: var(--berry-dark); border-color: var(--berry-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 24px 0 12px; }
.actions form { margin: 0; }

/* ---- 入力 ---- */
input[type="text"], input[type="search"], input[type="date"], select, textarea {
    font: inherit; font-size: 18px; color: var(--ink);
    background: var(--white); border: 1px solid var(--line); border-radius: 6px;
    min-height: 52px; padding: 10px 12px; max-width: 100%;
}
textarea { width: 100%; line-height: 1.8; display: block; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--leaf); outline-offset: 1px; border-color: var(--leaf); }
input[type="checkbox"] { width: 26px; height: 26px; accent-color: var(--leaf); flex: none; margin: 0; }
.field { margin: 0 0 20px; }
.field > label { display: block; font-weight: 700; }
.field > label > select, .field > label > input { display: block; margin-top: 4px; min-width: 14em; }

/* ---- 一覧 ---- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.rows > li { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.row-title { font-size: 19px; font-weight: 700; }
.row-title a { text-decoration: none; }
.row-title a:hover { text-decoration: underline; }
.row-meta { display: flex; flex-wrap: wrap; gap: 0 20px; color: var(--ink-soft); font-size: 16px; }
.rows > li.empty { color: var(--ink-soft); }
.tag { display: inline-block; padding: 0 8px; border: 1px solid var(--ink); border-radius: 4px; font-size: 15px; font-weight: 700; line-height: 1.7; }

/* 表（管理の一覧） */
.table { width: 100%; border-collapse: collapse; margin: 16px 0; background: var(--white); }
.table th, .table td { text-align: left; vertical-align: top; padding: 12px; border-bottom: 1px solid var(--rule); }
.table th { font-size: 15px; font-weight: 700; color: var(--ink-soft); background: var(--paper); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td a { font-weight: 700; }
.table .muted { color: var(--ink-soft); }
.table form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 0; }
.table form label { font-size: 15px; font-weight: 700; display: grid; gap: 4px; }

/* ---- 録音画面 ---- */
.recording h1 { margin-bottom: 0; }
.recording-date { color: var(--ink-soft); margin: 0 0 32px; }

/* 時間の背骨：左の縦線に ① 伝える → ② 録音→ ③ 録音のあと が下がる */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > .step { position: relative; padding: 0 0 48px 48px; }
.timeline > .step:last-child { padding-bottom: 0; }
.timeline > .step::before { /* 線 */
    content: ""; position: absolute; left: 13px; top: 16px; bottom: -16px; width: 2px; background: var(--rule);
}
.timeline > .step:last-child::before { display: none; }
.timeline > .step.done::before { background: var(--leaf); }
.timeline > .step::after { /* 節 */
    content: ""; position: absolute; left: 4px; top: 6px; width: 20px; height: 20px;
    border-radius: 50%; border: 2px solid var(--line); background: var(--paper);
}
.timeline > .step.done::after { background: var(--leaf); border-color: var(--leaf); }
.timeline > .step.current::after { background: var(--berry); border-color: var(--berry); }
.timeline h2 { margin: 0 0 16px; }
.timeline > .step[data-step="3"]::after { top: 30px; }

.consent-done { margin: 0; color: var(--leaf); font-weight: 700; }
.check-label { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin: 0 0 20px; }
.check-label input { margin-top: 5px; }

/* 録音（中身は recorder.js が描く） */
#recorder > p[role="status"] { line-height: 1.4; }
#recorder:has(.btn-stop) > p[role="status"] { color: var(--berry); }
/* 押すボタンが無い（録音を終えた・別の画面で開いている）ときは、状態を本文の大きさに落とす */
#recorder:not(:has(.btn:not([hidden]))) > p[role="status"] { font-size: 20px !important; color: var(--ink-soft); }
#recorder:has(.btn-stop) > p[role="status"]::before {
    content: ""; display: inline-block; width: .5em; height: .5em; margin-right: .35em; border-radius: 50%; background: var(--berry); vertical-align: .12em;
}
#recorder .error { margin: 8px 0; padding: 8px 12px; }
#recorder > p:last-child { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
#recorder > p:last-child > .btn-large:not(.btn-block) { min-width: 14em; }
#recorder[data-disabled] { color: var(--ink-soft); }
/* 録音中の声の大きさ（recorder.js の「声の大きさメーター」が描く。録音中だけ出る） */
#recorder .level-meter { width: 100%; height: 14px; margin: 4px 0 12px; border-radius: 7px; background: var(--rule); overflow: hidden; }
#recorder .level-meter-fill { width: 0; height: 100%; border-radius: 7px; background: var(--leaf); }
#recorder .level-meter.is-clip .level-meter-fill { background: var(--berry); }
.btn-stop { background: var(--berry); border-color: var(--berry); color: var(--white); }
.btn-stop:hover { background: var(--berry-dark); border-color: var(--berry-dark); color: var(--white); }

.after { background: var(--mist); border-radius: 8px; padding: 24px; }
.after:focus { outline: 2px solid var(--leaf); outline-offset: 3px; }
.after-lead { font-size: 20px; font-weight: 700; margin: 0 0 16px; }

.other-actions { margin-top: 56px; border-top: 1px solid var(--rule); }
.other-actions > summary { min-height: 52px; display: flex; align-items: center; cursor: pointer; color: var(--ink-soft); font-weight: 700; }
.other-actions > summary:hover { color: var(--ink); }
.other-actions .section { margin-top: 16px; }
.other-actions h3 { margin-bottom: 12px; }
.confirm-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ログイン */
.signin { max-width: 480px; padding-top: 32px; }
.signin h1 { margin-bottom: 8px; }
.signin .btn { margin-top: 24px; }

@media (max-width: 600px) {
    body { font-size: 17px; }
    .container { padding-top: 24px; }
    .site-header-inner { padding: 0 8px 0 16px; min-height: 56px; }
    .site-nav { order: 3; flex: 1 1 100%; margin: 0 -8px 0 -16px; border-top: 1px solid var(--rule); }
    .nav-link { flex: 1 1 0; justify-content: center; min-height: 52px; padding: 0 4px; font-size: 17px; }
    .site-user { font-size: 15px; gap: 0; }
    .section { margin-top: 40px; }
    .btn-large, .btn-primary, .actions .btn, .after .btn { display: flex; width: 100%; }
    .actions { flex-direction: column; align-items: stretch; }
    #recorder > p:last-child > .btn { width: 100%; min-width: 0; }
    .timeline > .step { padding-left: 36px; }
    .timeline > .step::before { left: 9px; }
    .timeline > .step::after { left: 1px; width: 18px; height: 18px; }
    .after { padding: 20px 16px; }
    /* 表は1行ずつの塊にする */
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    .table { background: none; border-top: 1px solid var(--rule); }
    .table tr { padding: 12px 0; border-bottom: 1px solid var(--rule); }
    .table td { padding: 0; border: 0; }
    .table td[data-label]::before { content: attr(data-label) "　"; color: var(--ink-soft); font-size: 15px; }
}

/* 指で触る端末（iPad・iPhone・Android）では文中のリンクも押せる高さにする */
@media (pointer: coarse) {
    .back-link a, .row-title a, .row-meta a, .lead a, .table td a, .section > a:not(.btn) { display: inline-flex; align-items: center; min-height: 52px; }
    .btn-quiet { min-height: 52px; }
    .check-label { min-height: 52px; align-items: center; }
    .check-label input { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
