:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-soft: #f7f7f5;
  --line: #e9e9e7;
  --line-strong: #d9d9d6;
  --text: #37352f;
  --muted: #787774;
  --muted-light: #a6a5a1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --red: #d92d3a;
  --green: #1f8f5f;
  --amber: #b56a00;
  --shadow: 0 16px 48px rgba(32, 35, 45, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.65;
}

button, a { font: inherit; }

button { color: inherit; }

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mobile-notice { display: none; }

.desktop-app { min-height: 100vh; }

.app-header {
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.app-mark {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: var(--text);
}

.app-mark span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

.mock-badge {
  padding: 4px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.install-button {
  height: 36px;
  padding: 0 13px;
  color: var(--accent);
  background: #fff;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.install-button:hover { background: rgba(37, 99, 235, 0.06); }

.install-button[hidden] { display: none; }

.account-button {
  height: 40px;
  padding: 0 10px 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}

.account-button:hover { background: var(--surface-soft); }

.account-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #5965d8;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
}

.account-button svg { width: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; }

.account-label { font-size: 12px; color: var(--muted); }

.connection-status,
.connection-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.connection-button {
  min-height: 38px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.connection-button:hover { color: var(--text); background: var(--surface-soft); }

.connection-status > span,
.connection-button > span:first-child {
  width: 7px;
  height: 7px;
  background: var(--muted-light);
  border-radius: 50%;
}

.connection-button.is-connected > span:first-child { background: var(--green); }

.app-main {
  width: min(100% - 48px, 960px);
  margin: 0 auto;
  padding: 72px 0 40px;
}

.recorder-shell {
  width: min(100%, 640px);
  min-height: 520px;
  margin: 0 auto;
  padding: 48px 56px 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.state-view { display: none; }
.state-view.is-active { display: block; }
.state-view--center { text-align: center; padding-top: 18px; }

.hero-icon,
.progress-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 15px;
}

.hero-icon svg,
.progress-icon svg {
  width: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-icon--ready { color: var(--accent); background: #eef3ff; }
.hero-icon--success { color: var(--green); background: #edf8f3; }
.hero-icon--warning { color: var(--amber); background: #fff7e8; }
.progress-icon { color: var(--accent); background: #eef3ff; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
}

.eyebrow--success { color: var(--green); }

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 22px; line-height: 1.45; text-align: center; }
h2 { font-size: 18px; line-height: 1.5; }

.lead {
  max-width: 460px;
  margin: 10px auto 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.primary-button,
.secondary-button {
  min-height: 52px;
  border-radius: 12px;
  border: 0;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}

.primary-button {
  width: 100%;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover { background: var(--accent-hover); }
.primary-button:active { transform: translateY(1px); }
.primary-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.primary-button svg circle { fill: currentColor; stroke: none; }
.primary-button--danger { background: var(--red); }
.primary-button--danger:hover { background: #bd2633; }
.primary-button--compact { width: auto; min-height: 44px; padding: 0 18px; }
.primary-button--stop { min-height: 68px; font-size: 16px; }
.stop-symbol { width: 14px; height: 14px; background: currentColor; border-radius: 3px; }

.source-guide {
  margin: 0 0 24px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #f0f1f3;
  border-radius: 14px;
}

.source-guide > div {
  min-width: 0;
  padding: 13px 8px 11px;
  color: #686964;
  background: #e5e6e8;
  border: 1px solid #dbdcde;
  border-radius: 10px;
  font-size: 11px;
  text-align: center;
}

.source-guide__icon { width: 34px; height: 30px; margin: 0 auto 7px; display: grid; place-items: center; color: #777873; }
.source-guide__icon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.settings-list { margin-top: 32px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.setting-row--secondary { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.setting-label, .setting-note, .meta-label, .meta-value { display: block; }
.setting-label { font-weight: 500; }
.setting-note, .audio-note { color: var(--muted); font-size: 12px; }
.setting-note { max-width: 410px; }
.audio-note { margin: 12px 0 0; }

.toggle {
  min-width: 78px;
  height: 44px;
  padding: 0 5px 0 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.toggle:not(.is-on) { padding: 0 11px 0 5px; color: var(--muted); background: var(--line); flex-direction: row-reverse; }
.toggle-label { font-size: 11px; font-weight: 600; }
.toggle-knob { width: 26px; height: 26px; background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); }

.meta-list { padding-top: 8px; }
.meta-row { min-height: 62px; display: flex; align-items: center; gap: 14px; }
.meta-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); background: var(--surface-soft); border-radius: 10px; }
.meta-icon svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.meta-label { color: var(--muted); font-size: 11px; }
.meta-value { margin-top: 1px; font-size: 13px; }

.countdown-number {
  margin: 4px 0 20px;
  color: var(--accent);
  font-size: 92px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.text-button { min-height: 42px; padding: 0 14px; color: var(--muted); background: transparent; border: 0; border-radius: 9px; cursor: pointer; }
.text-button:hover { color: var(--text); background: var(--surface-soft); }

.recording-status { display: inline-flex; align-items: center; gap: 9px; margin-top: 8px; color: var(--red); font-weight: 600; }
.recording-dot { width: 10px; height: 10px; background: var(--red); border-radius: 50%; }
.timer { margin: 18px 0 4px; font-size: 52px; font-weight: 500; line-height: 1.15; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.mic-status { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.source-status { margin: 10px 0 0; color: var(--text); font-size: 13px; font-weight: 500; }

.progress-icon--working svg { animation: working-pulse 1.2s ease-in-out infinite; }

@keyframes working-pulse {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(2px); opacity: 0.55; }
}

.recording-preview {
  width: 100%;
  max-height: 260px;
  margin: 2px 0 20px;
  display: block;
  background: #252521;
  border-radius: 12px;
}

.recording-summary {
  margin: 0 0 22px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  background: var(--surface-soft);
  border-radius: 12px;
  text-align: left;
}

.recording-summary div { min-width: 0; }
.recording-summary span,
.recording-summary strong { display: block; }
.recording-summary span { color: var(--muted); font-size: 11px; }
.recording-summary strong { margin-top: 1px; overflow: hidden; font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

.file-name-field { margin: 0 0 18px; display: block; text-align: left; }
.file-name-field > span:first-child { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 500; }
.file-name-control { min-height: 50px; display: flex; align-items: center; overflow: hidden; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 11px; }
.file-name-control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13); }
.file-name-control input { min-width: 0; flex: 1; height: 48px; padding: 0 14px; color: var(--text); background: transparent; border: 0; outline: 0; font: inherit; }
.date-chip { margin-right: 8px; padding: 5px 8px; flex: 0 0 auto; color: var(--muted); background: var(--surface-soft); border-radius: 7px; font-size: 11px; font-variant-numeric: tabular-nums; }
.file-name-field small { margin-top: 6px; display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.save-destination,
.transcript-status { margin: 0 0 18px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--surface-soft); border-radius: 10px; text-align: left; }
.save-destination span,
.transcript-status span { color: var(--muted); font-size: 11px; }
.save-destination strong,
.transcript-status strong { font-size: 12px; font-weight: 500; text-align: right; }

.transcript-status { margin-top: 18px; }
.transcript-status__detail { min-width: 0; display: grid; gap: 4px; justify-items: end; }
.transcript-status__detail small { max-width: 330px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.progress-track { height: 8px; margin-top: 30px; overflow: hidden; background: var(--line); border-radius: 999px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: inherit; transition: width 280ms ease; }
.progress-meta { margin-top: 8px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.status-steps { margin: 30px 0 0; padding: 20px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); list-style: none; }
.status-steps li { position: relative; color: var(--muted-light); font-size: 11px; text-align: center; }
.status-steps li span { width: 18px; height: 18px; margin: 0 auto 7px; display: grid; place-items: center; background: var(--line); border-radius: 50%; }
.status-steps li.is-current { color: var(--text); }
.status-steps li.is-current span { background: var(--accent); box-shadow: 0 0 0 4px #eef3ff; }
.status-steps li.is-done { color: var(--muted); }
.status-steps li.is-done span { background: var(--green); }
.status-steps li.is-done span::after { content: "✓"; color: #fff; font-size: 11px; line-height: 1; }

.share-confirmation { margin-top: 18px; display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-size: 12px; font-weight: 500; }
.share-confirmation svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.destination-summary { width: min(100%, 420px); margin: 18px auto; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; text-align: left; }
.destination-summary span { color: var(--muted); font-size: 11px; }
.destination-summary strong { min-width: 0; color: var(--text); font-size: 12px; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.processing-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.secondary-actions { margin-top: 28px; padding-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; border-top: 1px solid var(--line); }
.secondary-actions button { min-height: 40px; padding: 0 12px; color: var(--muted); background: transparent; border: 0; border-radius: 9px; cursor: pointer; font-size: 12px; }
.secondary-actions button:hover:not(:disabled) { color: var(--text); background: var(--surface-soft); }
.secondary-actions button:disabled { color: var(--muted-light); cursor: not-allowed; }

.privacy-note { margin: 20px auto 0; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: 11px; }
.privacy-note svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.prototype-controls { width: min(100%, 640px); margin: 22px auto 0; color: var(--muted); font-size: 11px; }
.prototype-controls summary { width: fit-content; margin: 0 auto; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.prototype-controls summary:hover { background: rgba(255, 255, 255, 0.75); }
.prototype-controls__body { margin-top: 10px; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.prototype-controls__body button { min-height: 34px; padding: 0 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.prototype-controls__body button:hover { color: var(--text); border-color: var(--line-strong); }

.modal[hidden], .toast[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(30, 31, 34, 0.36); }
.modal__panel { position: relative; width: min(100%, 440px); padding: 28px; background: var(--surface); border-radius: 16px; box-shadow: 0 24px 72px rgba(20, 22, 28, 0.2); }
.modal__panel p { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.browser-symbol { width: 42px; height: 42px; margin-bottom: 18px; display: grid; place-items: center; color: var(--accent); background: #eef3ff; border-radius: 12px; }
.browser-symbol svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.modal__note { margin-top: 18px; padding: 11px 13px; color: var(--muted); background: var(--surface-soft); border-radius: 9px; font-size: 12px; }
.modal__actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 8px; }
.secondary-button { min-height: 44px; padding: 0 16px; background: var(--surface); border: 1px solid var(--line-strong); }
.secondary-button:hover { background: var(--surface-soft); }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 30; transform: translateX(-50%); padding: 10px 14px; color: #fff; background: var(--text); border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; }

@media (max-width: 767px) {
  .desktop-app { display: none; }
  .mobile-notice { min-height: 100vh; padding: 24px; display: grid; place-items: center; }
  .mobile-notice__card { width: 100%; max-width: 360px; padding: 32px 24px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
  .mobile-notice__card .app-mark { margin: 0 auto 22px; }
  .mobile-notice__card h1 { font-size: 19px; }
  .mobile-notice__card p { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
}

@media (max-height: 760px) and (min-width: 768px) {
  .app-main { padding-top: 32px; }
  .recorder-shell { min-height: 480px; padding-top: 36px; }
}

@media (max-width: 900px) and (min-width: 768px) {
  .account-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* Five image choices stay on one row; native radios support arrow keys. */
.background-setting { min-width: 0; margin: 20px 0 0; padding: 0; border: 0; }
.background-setting legend { padding: 0; margin-bottom: 12px; }
.background-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.background-option { position: relative; display: flex; flex-direction: column; gap: 8px; align-items: center; min-width: 0; min-height: 44px; padding: 4px 2px 6px; cursor: pointer; border-radius: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.background-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.background-option img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 5px; }
.background-option span { white-space: nowrap; }
.background-option:has(input:checked) { color: var(--accent); background: #eef3ff; }
.background-option input:checked + img { box-shadow: 0 0 0 2px var(--accent); }
.background-option input:focus-visible + img { outline: 3px solid var(--accent); outline-offset: 3px; }
.background-option:hover { background: var(--surface-soft); }
.background-option:has(input:checked):hover { background: #eef3ff; }
