/* COACHING-L shared branding. Source and revision: see DESIGN.md. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #edf0f3;
  --text: #293746;
  --text-muted: #5f6d7c;
  --heading: #042143;
  --accent: #042143; /* 主なボタン・選んだ項目 */
  --accent-strong: #02172f;
  --accent-soft: #eaeef3;
  --accent-contrast: #ffffff;
  --gold: #c09e5c; /* 飾りの線 */
  --gold-text: #98783d; /* 大きな文字（24px 以上）に使う金 */
  --gold-label: #7a5f2c; /* 小さな文字に使う金（背景に対して 4.5:1 以上） */
  --gold-soft: #faf6ec;
  --border: #d3dae2; /* ボタンの枠 */
  --input-border: #808c99; /* 入力欄の枠（背景に対して 3:1 以上） */
  --line: #e0e5ea; /* 区切り線・カードの枠 */
  --focus-halo: rgba(
    192,
    158,
    92,
    0.22
  ); /* 入力欄を選んだときの金の淡い光（ホームページと同じ） */
  /* グラフ：集中度 1〜5 を紺の濃淡で。灰色は未記入（良し悪しを赤や緑で表さない） */
  --chart-1: #c9d4e0;
  --chart-2: #9db0c6;
  --chart-3: #6a84a3;
  --chart-4: #34527a;
  --chart-5: #042143;
  --chart-none: #eceef1;
  --chart-none-stroke: #aab3bd;
  --chart-track: #f0f2f5;
  --badge-done-bg: #e6ecf3;
  --badge-done-text: #042143;
  --badge-rest-bg: #faf6ec;
  --badge-rest-text: #7a5f2c;
  --focus-ring: #98783d;
  --warn-text: #7a5f2c;

  --radius: 10px; /* カード（ホームページと同じ） */
  --radius-small: 8px; /* ボタン・入力欄（ホームページと同じ） */
  --radius-pill: 999px;
  --shadow: 0 8px 24px rgba(2, 23, 47, 0.08);
  --font:
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Noto Sans JP",
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic",
    "Meiryo", system-ui, sans-serif;

  color-scheme: light dark;
}

/* ダークモードは、紺を背景にして金を差し色にする。
   「自動」で端末がダークのときと、「ダーク」を選んだときの2か所に、同じ値を書いている（変えるときは両方そろえる） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #02172f;
    --surface: #0a2945;
    --surface-muted: #0b2440;
    --text: #e9edf1;
    --text-muted: #a8b4c2;
    --heading: #f3f5f8;
    --accent: #c09e5c;
    --accent-strong: #d1b47a;
    --accent-soft: #0f3152;
    --accent-contrast: #02172f;
    --gold: #c09e5c;
    --gold-text: #d6bd8a;
    --gold-label: #d6bd8a;
    --gold-soft: #2a2a24;
    --border: #24476b;
    --input-border: #557699;
    --line: #1a3a5c;
    --focus-halo: var(--accent-soft);
    /* グラフ：集中度 1〜5 を金の濃淡で */
    --chart-1: #4a4436;
    --chart-2: #6e6143;
    --chart-3: #94804f;
    --chart-4: #b7995b;
    --chart-5: #e0c48a;
    --chart-none: #1a3553;
    --chart-none-stroke: #4f6f92;
    --chart-track: #0f3152;
    --badge-done-bg: #133a5e;
    --badge-done-text: #dbe5f0;
    --badge-rest-bg: #3a3221;
    --badge-rest-text: #e8d3a6;
    --focus-ring: #c09e5c;
    --warn-text: #e3c48f;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  --bg: #02172f;
  --surface: #0a2945;
  --surface-muted: #0b2440;
  --text: #e9edf1;
  --text-muted: #a8b4c2;
  --heading: #f3f5f8;
  --accent: #c09e5c;
  --accent-strong: #d1b47a;
  --accent-soft: #0f3152;
  --accent-contrast: #02172f;
  --gold: #c09e5c;
  --gold-text: #d6bd8a;
  --gold-label: #d6bd8a;
  --gold-soft: #2a2a24;
  --border: #24476b;
  --input-border: #557699;
  --line: #1a3a5c;
  --focus-halo: var(--accent-soft);
  /* グラフ：集中度 1〜5 を金の濃淡で */
  --chart-1: #4a4436;
  --chart-2: #6e6143;
  --chart-3: #94804f;
  --chart-4: #b7995b;
  --chart-5: #e0c48a;
  --chart-none: #1a3553;
  --chart-none-stroke: #4f6f92;
  --chart-track: #0f3152;
  --badge-done-bg: #133a5e;
  --badge-done-text: #dbe5f0;
  --badge-rest-bg: #3a3221;
  --badge-rest-text: #e8d3a6;
  --focus-ring: #c09e5c;
  --warn-text: #e3c48f;
  --shadow: none;
}

/* アプリで選んだ表示に、入力欄やチェックボックスなどブラウザの部品の色も合わせる */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

:root {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
[hidden] {
  display: none !important;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
main {
  max-width: 480px;
  margin: auto;
  padding: max(28px, env(safe-area-inset-top)) 20px
    max(16px, env(safe-area-inset-bottom));
}
button,
input,
select {
  font: inherit;
}
button,
.button {
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled,
fieldset:disabled {
  opacity: 0.48;
}
fieldset:disabled button {
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
.file-button:has(+ input:focus-visible) {
  outline: 3px solid var(--focus-ring);
  outline-offset: 4px;
}
button {
  border: 0;
}
h1,
h2,
p {
  margin: 0;
}
h2 {
  font-size: 16px;
  letter-spacing: 0.025em;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 0 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-logo {
  flex: none;
  width: 52px;
  height: 52px;
}
.brand-name {
  color: var(--heading);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.14em;
}
.app-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  line-height: 1.7;
}
.lead {
  padding-left: 14px;
  border-left: 4px solid var(--gold);
  color: var(--heading);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.45;
}
.intro {
  padding: 38px 0 27px;
}
h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.5;
}
.intro > p:last-child {
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 14px;
}
.mobile-break {
  display: none;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border: 1.5px solid transparent;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  white-space: nowrap;
}
.primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.secondary {
  background: var(--accent-soft);
  color: var(--accent);
}
.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 0;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 22px;
}
.tag {
  background: var(--surface-muted);
  padding: 2px 10px;
  border-radius: 5px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
}
.tag.waiting {
  background: var(--gold-soft);
  color: var(--gold-label);
}
fieldset {
  padding: 0;
  border: 0;
  margin: 0;
  min-width: 0;
}
.time-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.time-row output {
  font-size: 29px;
  letter-spacing: 0.01em;
  color: var(--heading);
  font-weight: 500;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin: 12px 0;
  cursor: pointer;
  min-height: 24px;
}
.ab-legend {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.transport {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 38px;
  padding: 17px 0 27px;
}
.play-button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
}
.play-button svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}
.play-button[data-state="playing"] .icon-play,
.play-button[data-state="paused"] .icon-pause {
  display: none;
}
.skip svg,
.mini-skip svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.skip {
  background: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  min-width: 44px;
  min-height: 48px;
}
.skip span {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 4px;
}
.speed-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.label-row > span {
  font-size: 0.9375rem;
  font-weight: 500;
}
.label-row output {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 5px;
}
label {
  font-size: 12px;
  font-weight: 500;
}
.range-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-bottom: 8px;
}
.text-button {
  background: none;
  color: var(--heading);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.875rem;
  padding: 6px 3px;
  min-height: 32px;
}
.small {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.advanced label {
  display: block;
}
select,
input[type="text"],
input[type="number"] {
  border: 1px solid var(--input-border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  min-height: 48px;
  padding: 9px 11px;
  width: 100%;
  font-size: 14px;
}
select {
  margin-top: 6px;
}
.points {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0 7px;
}
.point-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 6px;
}
.point-heading label {
  font-size: 0.9375rem;
  white-space: nowrap;
}
.point-letter {
  display: inline-grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--heading);
  border-radius: 4px;
  width: 21px;
  height: 21px;
  font-size: 13px;
  margin-right: 4px;
}
.point-letter.b {
  background: var(--gold-soft);
  color: var(--gold-label);
}
.point input {
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  letter-spacing: 0.02em;
}
.repeat-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0 12px;
}
.gap-input {
  position: relative;
  margin-top: 6px;
}
.gap-input input {
  padding-right: 32px;
}
.gap-input span {
  position: absolute;
  right: 12px;
  top: 10px;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.gap-seconds {
  margin-bottom: 12px;
}
.delete-button,
.rename-button {
  background: none;
  color: var(--text-muted);
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-small);
}
@media (hover: hover) {
  .delete-button:hover,
  .rename-button:hover {
    background: var(--surface-muted);
    color: var(--heading);
  }
}
.error {
  background: var(--gold-soft);
  border-radius: var(--radius-small);
  color: var(--gold-label);
  padding: 14px 16px;
  font-size: 0.9375rem;
  margin: 10px 0;
}
.error[hidden] {
  display: none;
}
.notice {
  font-size: 0.9375rem;
  color: var(--text-muted);
  min-height: 26px;
  margin: 6px 0;
}
footer {
  display: flex;
  gap: 40px;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
  padding: 23px 0 4px;
}
footer p:last-child {
  max-width: 440px;
}
.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;
}
@media (max-width: 720px) {
  main {
    padding: 18px 17px;
  }
  .brand-en {
    display: none;
  }
  .intro {
    padding: 28px 0 22px;
  }
  h1 {
    font-size: 27px;
  }
  .workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .card {
    padding: 21px 18px;
  }
  .section-heading {
    margin-bottom: 18px;
  }
  .point-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }
  .points {
    gap: 12px;
  }
  .text-button {
    min-height: 40px;
  }
  .point input {
    font-size: 17px;
  }
  footer {
    display: block;
  }
  footer p + p {
    margin-top: 8px;
  }
  .transport {
    padding-bottom: 22px;
  }
  .mobile-break {
    display: block;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Compact, single-column tool layout shared with the pomodoro app. */
.page-header {
  border: 0;
  padding-bottom: 0;
}
.intro {
  padding: 28px 0;
}
.card {
  padding: 20px;
}
.file-button {
  width: 100%;
}
.section-heading h2 {
  color: var(--heading);
}
.point-heading {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
label {
  font-size: 14px;
  font-weight: 600;
}
select,
input[type="text"],
input[type="number"] {
  font-size: 16px;
}
.text-button {
  min-height: 44px;
}
.primary:hover,
.play-button:hover {
  background: var(--accent-strong);
}
.secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--heading);
}
.secondary:hover {
  border-color: var(--heading);
}
footer {
  display: block;
  border-top: 1px solid var(--line);
  margin-top: 28px;
  text-align: center;
  padding-top: 20px;
}
footer p {
  margin-bottom: 8px;
}
.footer-brand {
  color: var(--heading);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}
@media (max-width: 720px) {
  main {
    padding: max(28px, env(safe-area-inset-top)) 20px
      max(16px, env(safe-area-inset-bottom));
  }
}

/* Typography follows pomodoro body, field-label, hint and button rules. */
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.intro > p:last-child {
  font-size: 0.9375rem;
}
label {
  font-size: 0.9375rem;
}
.file-button {
  min-height: 56px;
}
.gauge-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  margin-top: 10px;
}
.gauge-tools button {
  white-space: nowrap;
}
/* 区間リピートのON・OFF：押せることが分かるスイッチの形 */
.repeat-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 2px;
  background: none;
  color: var(--heading);
  font-size: 0.9375rem;
  font-weight: 700;
}
.switch-track {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 30px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}
.repeat-switch[aria-pressed="true"] .switch-track {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}
.interval-gauge {
  position: relative;
  height: 140px;
  margin-top: 4px;
}
.interval-track {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 24px;
  height: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  pointer-events: none;
}
#interval-fill {
  position: absolute;
  height: 100%;
  left: 0;
  right: 0;
  background: var(--gold);
  opacity: 0.8;
}
.interval-gauge #seek {
  position: absolute;
  top: 6px;
  left: 10px;
  width: calc(100% - 20px);
  margin: 0;
  height: 44px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}
#seek::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
}
#seek::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
#seek::-moz-range-track {
  height: 8px;
  background: transparent;
}
#seek::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}
.interval-markers {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  bottom: 0;
  pointer-events: none;
}
.interval-marker {
  position: absolute;
  left: 0;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  touch-action: none;
  pointer-events: auto;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}
.marker-a {
  top: 48px;
}
.marker-b {
  top: 94px;
  left: 100%;
  border-color: var(--gold-label);
  color: var(--gold-label);
}
.interval-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  height: 22px;
  border-left: 1px solid currentColor;
  pointer-events: none;
}
.marker-b::before {
  height: 68px;
}
.interval-marker:active {
  background: var(--accent-soft);
}
.gauge-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.gauge-actions button {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 8px;
}
.audio-library {
  margin-bottom: 20px;
}
.audio-entry {
  transition:
    background 0.15s,
    border-color 0.15s;
}
.audio-entry.dragging {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.audio-library .section-heading,
.audio-entry .section-heading,
.text-entry .section-heading {
  margin-bottom: 8px;
}
.file-hint {
  margin-top: 8px;
}
.now-playing {
  margin: -12px 0 16px;
  color: var(--heading);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.audio-list {
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  margin: 12px 0;
  padding: 0;
}
.audio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 8px 0;
}
.audio-open {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  color: var(--heading);
  padding: 10px 8px;
  min-height: 44px;
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
}
.audio-open:hover,
.audio-item.current .audio-open {
  background: var(--accent-soft);
}
.audio-item.current .audio-open {
  font-weight: 700;
  border-left: 3px solid var(--gold);
}
.audio-item .delete-button,
.audio-item .rename-button {
  flex-shrink: 0;
}
.storage-info {
  margin-top: 4px;
}
#library-status {
  overflow-wrap: anywhere;
}

.offline-card {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius-small);
}
.offline-card p + p {
  margin-top: 6px;
}
.load-actions {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}
.load-actions:has(> button[hidden]) {
  display: none;
}
.usage-guide {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.usage-guide > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  min-height: 52px;
  list-style: none;
}
.usage-guide > summary::-webkit-details-marker {
  display: none;
}
.usage-guide > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease;
}
.usage-guide[open] > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}
.usage-body {
  padding: 0 18px 20px;
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.usage-body section + section {
  margin-top: 20px;
}
.usage-body h2 {
  font-size: 1rem;
  color: var(--heading);
  margin-bottom: 8px;
}
.usage-body p + p {
  margin-top: 8px;
}
/* 個人情報の注意：本文より目立たせ、太字の一文を見出しのように読ませる */
.usage-body .privacy-note {
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: var(--accent-soft);
  color: var(--text);
}
.usage-body .privacy-note strong {
  color: var(--heading);
}
.usage-body .offline-card {
  margin: 12px 0 0;
  padding: 12px;
}
.usage-guide > summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* 詳しい設定：細かい設定は折りたたむ（「ご利用にあたって」と同じ矢印） */
.advanced {
  padding: 0;
}
.advanced > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  min-height: 52px;
  cursor: pointer;
  list-style: none;
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
}
.advanced > summary::-webkit-details-marker {
  display: none;
}
.advanced > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease;
}
.advanced[open] > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}
.advanced > summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}
.advanced-group {
  margin: 0 20px;
  padding: 16px 0 20px;
  border-top: 1px solid var(--line);
}
.advanced-title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--heading);
}
.advanced-group .small + .small {
  margin-top: 6px;
}
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.record-actions .button {
  flex: 1 1 180px;
  font-size: 0.9375rem;
}
.transcribe-warning {
  font-weight: 600;
  color: var(--gold-label);
  margin-bottom: 10px;
}


/* 削除の取り消しと、画面下のミニプレーヤー（画面幅は本体と同じ 480px まで） */
.undo-bar,
.mini-player {
  position: fixed;
  left: 16px;
  right: 16px;
  z-index: 10;
  max-width: 448px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.undo-bar {
  bottom: max(16px, env(safe-area-inset-bottom));
  padding: 8px 8px 8px 16px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.9375rem;
}
.has-mini-player .undo-bar {
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 76px);
}
.undo-bar p {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.undo-button {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mini-player {
  bottom: max(12px, env(safe-area-inset-bottom));
  min-height: 64px;
  padding: 8px 8px 8px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.has-mini-player main {
  padding-bottom: calc(max(16px, env(safe-area-inset-bottom)) + 84px);
}
.mini-info {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.mini-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--heading);
  font-size: 0.875rem;
  font-weight: 700;
}
.mini-time {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.mini-time span + span {
  margin-left: 6px;
}
.mini-skip,
.mini-play {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.mini-skip {
  background: none;
  color: var(--text-muted);
}
.mini-skip svg {
  width: 22px;
  height: 22px;
}
.mini-play {
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: var(--accent-contrast);
}
.mini-play svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.mini-play[data-state="playing"] .icon-play,
.mini-play[data-state="paused"] .icon-pause {
  display: none;
}

/* 波形：区間の中は金、外は灰色。波形があるときは細いバーの代わりに使う */
.waveform {
  --wave-inside: var(--gold);
  --wave-outside: var(--input-border);
  position: absolute;
  left: 22px;
  right: 22px;
  top: 4px;
  width: calc(100% - 44px);
  height: 48px;
  pointer-events: none;
}
.interval-gauge.has-waveform {
  height: 150px;
}
.has-waveform .interval-track {
  display: none;
}
.has-waveform .marker-a {
  top: 58px;
}
.has-waveform .marker-a::before {
  height: 30px;
}
.has-waveform .marker-b {
  top: 104px;
}
.has-waveform .marker-b::before {
  height: 76px;
}
.phrase-actions {
  margin-top: 10px;
}



/* キーボード操作の一覧 */
.shortcut-list {
  margin: 8px 0 0;
}
.shortcut-list div {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  border-top: 1px solid var(--line);
}
.shortcut-list dt {
  flex: 0 0 44%;
  color: var(--heading);
  font-weight: 600;
}
.shortcut-list dd {
  margin: 0;
}

/* ゲージの拡大・縮小 */
/* 表示範囲の文字はボタンの下の行に置き、拡大しても高さが変わらないようにする */
.zoom-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 4px;
}
.zoom-range {
  order: 2;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.zoom-buttons {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.zoom-buttons .text-button {
  padding: 6px 8px;
}

/* スクリプト：1文ずつの行。再生中の文は金の背景、選んだ文は枠で示す */
.transcript-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.transcript-actions .button {
  flex: 1 1 180px;
  font-size: 0.9375rem;
}
.transcript-editor textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.7;
  resize: vertical;
}
.transcript-sentences {
  position: relative;
  max-height: min(50vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 4px -8px 8px;
  padding: 4px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.sentence {
  display: block;
  width: 100%;
  padding: 8px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-small);
  background: none;
  color: var(--text);
  font-size: 1.0625rem;
  line-height: 1.7;
  text-align: left;
  overflow-wrap: anywhere;
  transition: background-color 0.15s ease;
}
/* タッチ端末ではタップ後もホバーが残るため、マウスのある端末だけに付ける */
@media (hover: hover) {
  .sentence:hover {
    background: var(--accent-soft);
  }
}
.sentence.is-current {
  background: var(--gold-soft);
  color: var(--heading);
  box-shadow: inset 4px 0 0 var(--gold);
}
.sentence.is-selected {
  border-color: var(--border);
}
.transcript-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.transcribe-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.transcribe-block .transcript-actions + .small {
  margin-top: 10px;
}
.transcribe-bar {
  display: block;
  width: 100%;
  height: 10px;
  margin-top: 8px;
  accent-color: var(--accent);
}

/* 入口：テキストから始める／音源から始める */
.entry-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.entry-button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 88px;
  padding: 14px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--heading);
  text-align: left;
}
.entry-button[aria-pressed="true"] {
  border-color: var(--heading);
  box-shadow: inset 0 0 0 1.5px var(--heading);
}
.entry-title {
  font-size: 1rem;
  font-weight: 700;
}
.entry-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.text-entry,
.audio-entry {
  margin-bottom: 20px;
}
.tts-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.text-entry textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.7;
  resize: vertical;
}
.tts-note {
  margin-top: 12px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 8px;
  cursor: pointer;
}
.check-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
@media (max-width: 360px) {
  .entry-choice,
  .tts-options {
    grid-template-columns: 1fr;
  }
}

/* 練習のしかた：シャドーイングとリピーティングの切り替え */
.mode-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-bottom: 18px;
}
.mode-label {
  font-size: 0.9375rem;
  font-weight: 500;
}
.mode-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 8px;
}
.mode-choice {
  min-height: 48px;
  padding: 6px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--heading);
  font-size: 0.9375rem;
  font-weight: 700;
}
.mode-choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

/* 再生速度：よく使う4つだけをボタンで（細かい速度は「詳しい設定」） */
.speed-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0 6px;
}
.speed-choice {
  min-height: 44px;
  padding: 6px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--heading);
  font-size: 0.9375rem;
  font-weight: 600;
}
.speed-choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

/* スクリプトがないときの「その他の方法」（文字起こし）と、ご利用にあたっての小さな折りたたみ */
.more-ways,
.shortcut-details {
  margin-top: 12px;
}
.more-ways > summary,
.shortcut-details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--heading);
}
.more-ways > summary::-webkit-details-marker,
.shortcut-details > summary::-webkit-details-marker {
  display: none;
}
.more-ways > summary::after,
.shortcut-details > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease;
}
.more-ways[open] > summary::after,
.shortcut-details[open] > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}
.more-ways > summary:focus-visible,
.shortcut-details > summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}
.more-ways {
  border-top: 1px solid var(--line);
  padding-top: 4px;
}
.more-title {
  margin: 4px 0 6px;
  font-size: 1rem;
  color: var(--heading);
}
.more-ways label {
  display: block;
}
.more-ways .transcript-actions + .small {
  margin-top: 10px;
}

/* スクリプトを直しているときだけ出す「文の時刻を直す」 */
.fit-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.fit-title {
  font-weight: 700;
  color: var(--heading);
}
.fit-block .button {
  margin-top: 10px;
  width: 100%;
  font-size: 0.9375rem;
}

/* 「テキストを消す」：入力欄の右下に小さく */
.text-tools {
  display: flex;
  justify-content: flex-end;
  min-height: 8px;
}
.rename-button {
  font-size: 1.125rem;
}
