/* Kirkas スタイル */
  :root {
    --bg: #f7f6f3; --card: #fff; --text: #3a3a37; --sub: #8a8a84;
    --accent: #7d9d8c; --accent-d: #5b7d6c; --line: #e5e4df;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  body {
    background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
    display: flex; flex-direction: column; align-items: center;
    min-height: 100vh;
    padding: 18px;
    padding-top: calc(18px + env(safe-area-inset-top));
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
    overscroll-behavior-y: contain;
  }
  @media (max-width: 420px) {
    body { padding-left: 12px; padding-right: 12px; }
    .card { padding: 15px; border-radius: 14px; }
    nav button { font-size: 12.5px; padding: 10px 0; }
    .hzBig, .resScore { font-size: 36px; min-width: 108px; }
    .sBig { font-size: 18px; }
    button.primary, button.secondary { padding: 14px 16px; }
    .navRow button { font-size: 13px; padding: 12px 8px; }
  }
  body.hidden-mode main, body.hidden-mode nav { filter: blur(20px); pointer-events: none; }
  header { width: 100%; max-width: 560px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  h1 { font-size: 17px; font-weight: 600; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
  .micBadge {
    font-size: 10.5px; font-weight: 600; color: #fff; background: #c47a7a;
    padding: 3px 8px; border-radius: 10px; letter-spacing: 0;
    display: inline-flex; align-items: center;
  }
  .recHint {
    display: none; font-size: 12px; color: #b08a4f; margin-top: 8px;
    background: rgba(194,160,107,.12); border-radius: 8px; padding: 8px 10px;
  }
  .hbtns { display: flex; gap: 8px; }
  header button {
    background: none; border: 1px solid var(--line); border-radius: 8px;
    padding: 6px 11px; color: var(--sub); font-size: 12px; cursor: pointer;
  }
  header button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
  nav { width: 100%; max-width: 560px; display: flex; gap: 6px; margin-bottom: 12px; }
  nav button {
    flex: 1; padding: 11px 0; border: 1px solid var(--line); border-radius: 10px;
    background: var(--card); color: var(--sub); font-size: 13.5px; cursor: pointer;
  }
  nav button.sel { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
  main { width: 100%; max-width: 560px; }
  .card { background: var(--card); border-radius: 16px; padding: 18px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
  .label { font-size: 12px; color: var(--sub); letter-spacing: .08em; margin-bottom: 8px; }
  .readout { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
  .hzBig { font-size: 42px; font-weight: 300; font-variant-numeric: tabular-nums; min-width: 132px; }
  .hzBig small { font-size: 17px; color: var(--sub); }
  .noteName { font-size: 17px; color: var(--sub); }
  .zoneTag { margin-left: auto; font-size: 12px; color: var(--accent); font-weight: 600; }
  canvas.pitchGraph { width: 100%; height: 180px; border-radius: 10px; background: #fdfdfb; border: 1px solid var(--line); display: block; }
  .vowels { display: flex; gap: 7px; margin-bottom: 12px; }
  .vowels button {
    flex: 1; padding: 8px 0; border: 1px solid var(--line); border-radius: 9px;
    background: #fdfdfb; color: var(--sub); font-size: 13px; cursor: pointer;
  }
  .vowels button.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
  .resWrap { position: relative; height: 42px; border-radius: 21px; border: 1px solid var(--line);
    background: linear-gradient(90deg, #d8ceba 0%, #ece7dc 45%, #dfe8e2 70%, #b9d2c5 100%); overflow: hidden; transition: opacity .3s; }
  .resWrap.unreliable { opacity: .35; }
  .resWrap .mid { position: absolute; left: 50%; top: 0; width: 1px; height: 100%; background: rgba(0,0,0,.12); }
  .resNeedle { position: absolute; top: 0; width: 4px; height: 100%; background: #4a5c53; border-radius: 2px; left: 50%; opacity: 0; }
  .resTicks { display: flex; justify-content: space-between; font-size: 11px; color: var(--sub); margin-top: 6px; }
  .resVal { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
  .resScore { font-size: 42px; font-weight: 300; font-variant-numeric: tabular-nums; min-width: 100px; }
  .resWord { font-size: 14px; color: var(--sub); }
  .relWarn { margin-left: auto; font-size: 11px; color: #b08a4f; }
  .formantsLine { font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; display: none; margin-top: 6px; }
  body.advanced .formantsLine { display: block; }
  /* 詳細モードのときだけ出す要素（共鳴の生スコアなど、参考値の扱い） */
  .advOnly { display: none; }
  body.advanced .advOnly { display: block; }
  .labelNote { font-size: 10.5px; color: var(--sub); background: var(--line); border-radius: 8px; padding: 2px 7px; margin-left: 6px; letter-spacing: 0; }
  .diffBig { font-size: 42px; font-weight: 300; font-variant-numeric: tabular-nums; }
  .diffBig.plus { color: var(--accent-d); }
  .controls { display: flex; gap: 10px; }
  button.primary { background: var(--accent); color: #fff; border: none; border-radius: 10px; padding: 13px 20px; font-size: 15px; cursor: pointer; flex: 1; }
  button.secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 13px 20px; font-size: 15px; cursor: pointer; flex: 1; }
  button:disabled { opacity: .4; }
  button.recording { background: #c47a7a; color: #fff; border: none; }
  .note-text { font-size: 11.5px; color: var(--sub); margin-top: 9px; line-height: 1.65; }
  audio { width: 100%; margin-top: 10px; display: none; }
  audio.visible { display: block; }
  .catTitle { font-size: 13px; font-weight: 600; color: var(--accent-d); margin: 16px 4px 8px; }
  .exItem {
    background: var(--card); border-radius: 13px; padding: 14px 16px; margin-bottom: 8px;
    display: flex; justify-content: space-between; align-items: center; cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
  }
  .exItem:active { background: #f4f3ef; }
  .exItem .t { font-size: 15px; }
  .exItem .done { font-size: 12px; color: var(--accent); margin-right: 6px; }
  .exItem .arrow { color: var(--line); font-size: 18px; }
  .exDesc { font-size: 13.5px; line-height: 1.8; }
  .exGoal { font-size: 12.5px; color: var(--accent-d); background: rgba(125,157,140,.1); border-radius: 8px; padding: 8px 12px; margin-top: 10px; }
  .sentence { font-size: 16px; line-height: 1.9; background: #fdfdfb; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
  .timerBig { font-size: 40px; font-weight: 300; text-align: center; font-variant-numeric: tabular-nums; margin: 6px 0; color: var(--accent-d); }
  .phaseLabel { text-align: center; font-size: 13px; color: var(--accent-d); font-weight: 600; margin-bottom: 4px; }
  .resultLine { font-size: 13.5px; line-height: 2; }
  .resultLine b { font-weight: 600; font-variant-numeric: tabular-nums; }
  .fb { margin-top: 8px; font-size: 13.5px; color: var(--accent-d); }
  .backLink { font-size: 13px; color: var(--sub); cursor: pointer; margin-bottom: 10px; display: inline-block; }
  .safety { font-size: 11.5px; color: #b08a4f; line-height: 1.6; margin: 4px 4px 20px; }
  .hiddenView { display: none !important; }
  .streak { font-size: 15px; }
  .streak b { font-size: 28px; font-weight: 600; color: var(--accent-d); }
  .chartRow { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: 10px; }
  .chartRow .bar { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .75; min-height: 2px; }
  .chartRow .bar.empty { background: var(--line); }
  .chartLabels { display: flex; gap: 4px; font-size: 9px; color: var(--sub); margin-top: 3px; }
  .chartLabels span { flex: 1; text-align: center; }
  .levelWrap { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
  .levelBar { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
  .levelBar > i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width .08s linear; }
  .levelTxt { font-size: 11.5px; color: var(--sub); min-width: 96px; text-align: right; }

  /* ===== 例文タブ ===== */
  .pickCard { padding: 14px 16px; }
  .pickRow { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
  .pickRow:last-of-type { margin-bottom: 0; }
  .pickLabel { font-size: 11.5px; color: var(--sub); min-width: 72px; letter-spacing: .04em; }
  .pickRow select {
    flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
    background: #fdfdfb; color: var(--text); font-size: 13.5px; font-family: inherit;
  }
  .miniBtn {
    flex: none; width: 38px; padding: 9px 0; border: 1px solid var(--line); border-radius: 9px;
    background: #fdfdfb; color: var(--sub); font-size: 14px; cursor: pointer;
  }
  .miniBtn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
  .searchRow { display: none; align-items: center; gap: 9px; margin-top: 8px; }
  .searchRow.open { display: flex; }
  .searchRow input {
    flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
    background: #fdfdfb; color: var(--text); font-size: 13.5px; font-family: inherit;
  }
  .lenRow { display: flex; gap: 6px; margin-top: 9px; }
  .lenRow button {
    flex: 1; padding: 7px 0; border: 1px solid var(--line); border-radius: 9px;
    background: #fdfdfb; color: var(--sub); font-size: 12.5px; cursor: pointer;
  }
  .lenRow button.sel { background: var(--accent); color: #fff; border-color: var(--accent); }

  .sBig { font-size: 19px; line-height: 2; padding: 18px 4px; min-height: 90px; }
  .sMeta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--sub); }
  .sMetaRight { display: flex; align-items: center; gap: 9px; }
  .favBtn { background: none; border: none; color: var(--line); font-size: 19px; line-height: 1;
    cursor: pointer; padding: 0 2px; }
  .favBtn.on { color: #c9a227; }
  .navRow { display: flex; gap: 10px; margin-top: 12px; }
  .rateSel { flex: none; width: 84px; padding: 13px 8px; border: 1px solid var(--line);
    border-radius: 10px; background: var(--card); color: var(--text); font-size: 14px;
    font-family: inherit; }

  .alertBar {
    width: 100%; max-width: 560px; background: #fdf6ea; border: 1px solid #e6d5b8;
    border-radius: 14px; padding: 14px 16px; margin-bottom: 12px;
  }
  .alertTitle { font-size: 13.5px; font-weight: 600; color: #8a6d3b; margin-bottom: 7px; }
  .alertBody { font-size: 12px; color: #8a6d3b; line-height: 1.85; }
  .alertBar button { margin-top: 10px; padding: 9px 16px; font-size: 13px; flex: none; }
  .noticeBar { background: #eef3f0; border-color: #cfdcd5; }
  .noticeBar .alertBody { color: #4a5c53; font-size: 12.5px; }

  /* 練習時間と設定 */
  .timeRow { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
  .timeLabel { font-size: 13px; color: var(--sub); }
  .timeVal { font-size: 22px; font-weight: 300; font-variant-numeric: tabular-nums; }
  .limitBar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 10px; }
  .limitBar > i { display: block; height: 100%; width: 0%; background: var(--accent); }
  .limitBar.over > i { background: #c2a06b; }
  .setRow { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
  .setLabel { font-size: 13px; color: var(--sub); flex: 1; }
  .setRow select {
    width: 148px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
    background: #fdfdfb; color: var(--text); font-size: 13.5px; font-family: inherit;
  }
  .setRow .chip { width: 148px; }
  .courseBar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: var(--accent); color: #fff; border-radius: 12px;
    padding: 11px 14px; margin-bottom: 12px; font-size: 13px;
  }
  .courseBar .courseBtns { margin-left: auto; display: flex; gap: 8px; }
  .courseBar .chip { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); color: #fff; }
  .chip {
    padding: 7px 14px; border: 1px solid var(--line); border-radius: 16px;
    background: #fdfdfb; color: var(--sub); font-size: 12.5px; cursor: pointer;
  }
  .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

  /* 通常 / 追いかけ / 連続 */
  .modeRow { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; flex-wrap: wrap; }
  .modeRow button {
    padding: 6px 14px; border: 1px solid var(--line); border-radius: 16px;
    background: #fdfdfb; color: var(--sub); font-size: 12.5px; cursor: pointer;
  }
  .modeRow button.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
  .modeRow .orderBtn { margin-left: auto; }
  .modeRow .orderBtn.on { background: var(--accent-d); color: #fff; border-color: var(--accent-d); }
  .modeNote { font-size: 11px; color: var(--sub); margin-top: 6px; line-height: 1.6; }
  .runBar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
  .runPhase { font-size: 12px; color: var(--accent-d); font-weight: 600; min-width: 68px; }
  .rapidDots { display: flex; gap: 4px; flex-wrap: wrap; }
  .rapidDots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); display: block; }
  .rapidDots i.on { background: var(--accent); }
  .rapidDots i.now { background: var(--accent-d); transform: scale(1.35); }

  /* ピッチのくらべ */
  .legendRow { display: flex; align-items: center; gap: 14px; margin-top: 8px; font-size: 11.5px; color: var(--sub); }
  .lg { display: inline-flex; align-items: center; }
  .lg::before { content: ''; display: inline-block; width: 18px; height: 0; margin-right: 6px; }
  .lgRef::before { border-top: 1.5px dashed var(--sub); }
  .lgMine::before { border-top: 3px solid var(--accent-d); }
  .lgNote { margin-left: auto; }

  /* 会話タブ */
  .talkTag { font-size: 11px; color: var(--sub); margin-right: 8px; }
  .talkTitle { font-size: 18px; font-weight: 600; }
  .talkRoles { display: flex; gap: 8px; margin-top: 2px; }
  .talkRole {
    flex: 1; min-width: 0; text-align: left; cursor: pointer;
    background: var(--card); color: var(--text);
    border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
    display: flex; flex-direction: column; gap: 3px;
  }
  .talkRole b { font-size: 14px; }
  .talkRole span {
    font-size: 11.5px; color: var(--sub);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .talkRole.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
  .talkRole.sel span { color: rgba(255,255,255,.85); }

  /* 会話のやりとり。相手は左、自分は右 */
  /* 下の余白は、いちばん下まで送ったときに最後の行が進行バーに近づきすぎないため */
  #talkLog { padding-bottom: 28px; }
  .talkRow { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; margin-bottom: 14px; }
  .talkRow.mine { align-items: flex-end; margin-left: auto; }
  .talkWho { font-size: 11px; color: var(--sub); margin: 0 5px 4px; }
  .talkBubble {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px 14px 14px 4px; padding: 12px 14px;
    font-size: 16px; line-height: 1.95;
  }
  .talkRow.mine .talkBubble {
    background: rgba(125,157,140,.13); border-color: rgba(125,157,140,.34);
    border-radius: 14px 14px 4px 14px;
  }
  .talkEcho { background: none; border: none; color: var(--sub); font-size: 11.5px;
    padding: 6px 5px 0; cursor: pointer; }
  .talkRowBtns { display: flex; gap: 10px; align-self: stretch; }
  .talkRow.mine .talkRowBtns { justify-content: flex-end; }

  /* 進行バー。行が増えても「つぎへ」に手が届くよう画面下に貼り付ける */
  .talkBar {
    position: sticky; bottom: calc(4px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 8px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; padding: 10px; margin-bottom: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
  }
  .talkBar .talkPos { font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; padding-left: 4px; }
  .talkBar button { flex: 0 1 auto; padding: 11px 16px; font-size: 14px; }
  .talkBar #talkNext { flex: 1; }

  /* 気づいたことを知らせる */
  .reportRow { display: flex; justify-content: flex-end; margin-top: 10px; }
  .reportLink { background: none; border: none; color: var(--sub); font-size: 11.5px;
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px; }
  /* ボタンの見た目をした外部リンク（設定画面の支援の導線）。
     button.secondary と同じ寸法にそろえてある */
  a.btnLink { display: block; text-align: center; text-decoration: none; }
  .aboutH { font-size: 12.5px; font-weight: 600; color: var(--accent-d); margin: 14px 0 4px; }
  .aboutH:first-of-type { margin-top: 10px; }
  .modal {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(58,58,55,.42);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }
  @media (min-width: 560px) { .modal { align-items: center; } }
  .modalCard {
    background: var(--card); border-radius: 16px; padding: 18px;
    width: 100%; max-width: 520px; box-shadow: 0 6px 28px rgba(0,0,0,.18);
  }
  .repTarget {
    font-size: 13px; line-height: 1.7; color: var(--text);
    background: #fdfdfb; border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 12px;
  }
  .repTarget b { font-weight: 600; }
  .repKinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
  #repText {
    width: 100%; border: 1px solid var(--line); border-radius: 10px;
    padding: 11px 12px; font-size: 15px; line-height: 1.7; color: var(--text);
    font-family: inherit; background: var(--card); resize: vertical;
  }
  #repText:focus { outline: none; border-color: var(--accent); }
  .repMsg { font-size: 12.5px; margin-top: 10px; min-height: 1.2em; color: var(--sub); }
  .repMsg.ok { color: var(--accent-d); font-weight: 600; }
  .repMsg.ng { color: #b08a4f; }

  /* はじめて開いたときの案内 */
  .welcomeTitle { font-size: 18px; font-weight: 600; margin-bottom: 14px; }
  #welcome p { font-size: 14px; line-height: 1.85; margin-bottom: 12px; }
  #welcome p:last-of-type { margin-bottom: 0; }
  #welcome .welcomeCare { font-size: 12px; line-height: 1.75; color: #b08a4f; }
