:root {
  --bg: #f7f5f0;
  --paper: #fff;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --ipa: #1a7a3c;
  --label: #7a2f9e;
  --tilde: #0b57a4;
  --wrong: #c62828;
  --line: #d8d2c8;
  --usage-border: #c62828;
  --usage-bg: #fff8f7;
  --bar: #ece8e1;
  --accent: #2f5d8c;
  --accent-hover: #254a70;
  --accent-press: #1f4468;
  --chrome: #c5bfb4;
  --example-playback-surface: #faf8f4;
  --example-playback-speaking-surface: #dbeafe;
  --example-playback-spinner-border: #c4d7e9;
  --pro-banner-height: 0px;
}
* { box-sizing: border-box; }
[hidden] {
  display: none !important;
}
html {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  touch-action: manipulation;
  overscroll-behavior: none;
}
body.sheet-open .layout {
  overflow: hidden !important;
}
.cat-buddy {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 18;
  width: 11rem;
  height: 11rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  will-change: transform;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
@media (prefers-reduced-motion: reduce) {
  .cat-buddy {
    display: none !important;
  }
}
.topbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.65rem 0.9rem;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.topbar.example-playback-active {
  z-index: 45;
}
.topbar select,
.topbar input,
.topbar button {
  font: inherit;
  padding: 0.4rem 0.55rem;
  border: 1px solid #c5bfb4;
  border-radius: 4px;
  background: #fff;
}
.topbar .combo {
  flex: 1;
  min-width: 0;
  position: relative;
}
.topbar .combo input {
  width: 100%;
  padding-right: 2.1rem;
}
.topbar .combo .clear-btn {
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.topbar .combo .clear-btn:hover,
.topbar .combo .clear-btn:active {
  color: var(--text);
  background: #e8e2d8;
}
.topbar .combo .clear-btn[hidden] {
  display: none !important;
}
.topbar .hist-btn {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  border-color: #c5bfb4;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}
/* 再生学習中・リスト閉じ後: ≡ を七色で目立たせる */
.topbar .hist-btn.study-play-glow {
  position: relative;
  z-index: 2;
  border: 2.5px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(
      90deg,
      #ff1744,
      #ff9100,
      #ffea00,
      #00e676,
      #00b0ff,
      #651fff,
      #d500f9,
      #ff1744
    ) border-box;
  background-size: auto, 300% 100%;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  background-clip: padding-box, border-box;
  -webkit-background-clip: padding-box, border-box;
  animation: hist-study-rainbow 1.8s linear infinite;
  box-shadow: 0 0 10px rgba(213, 0, 249, 0.35), 0 0 4px rgba(255, 23, 68, 0.35);
}
.topbar .hist-btn.study-play-glow::before {
  content: "≡";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: inherit;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(
    90deg,
    #ff1744,
    #ff9100,
    #ffea00,
    #00e676,
    #00b0ff,
    #651fff,
    #d500f9,
    #ff1744
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: hist-study-rainbow-text 1.8s linear infinite;
  pointer-events: none;
  background-position: 0% 50%;
}
@keyframes hist-study-rainbow {
  0% { background-position: 0% 50%, 0% 50%; }
  100% { background-position: 0% 50%, 300% 50%; }
}
@keyframes hist-study-rainbow-text {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .topbar .hist-btn.study-play-glow,
  .topbar .hist-btn.study-play-glow::before {
    animation: none;
  }
  .topbar .hist-btn.study-play-glow {
    background-position: 0% 50%, 40% 50%;
  }
  .topbar .hist-btn.study-play-glow::before {
    background-position: 40% 50%;
  }
}
.topbar button.go {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  border-color: #c5bfb4;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
}
.topbar .settings-btn {
  flex-shrink: 0;
  background: #fff;
  color: var(--accent);
  border-color: #c5bfb4;
  cursor: pointer;
  white-space: nowrap;
  min-width: 2.75rem;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}

.settings-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  max-height: min(86vh, calc(100dvh - env(safe-area-inset-top, 0px) - 3.5rem));
}
.settings-card .history-head {
  position: relative;
  top: auto;
  z-index: 2;
  flex-shrink: 0;
  margin: 0;
  padding: 1.15rem 1.1rem 0.7rem;
  border-radius: 14px 14px 0 0;
  background: #fff;
}
.settings-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 1.1rem 1.3rem;
  overscroll-behavior: contain;
}

.settings-row-btn {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.settings-row-btn:active {
  background: #f3efe8;
}
.settings-points-value {
  flex: 0 0 auto;
  min-width: 3.2rem;
  text-align: right;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.points-history-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px) + var(--pro-banner-height, 0px));
  transform: translateX(-50%) translateY(12px);
  z-index: 70;
  width: min(22rem, calc(100vw - 1.4rem));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.points-history-toast[hidden] {
  display: none !important;
}
.points-history-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.points-history-inner {
  background: #fff;
  border: 1.5px solid var(--line, #d8d2c8);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  padding: 0.75rem 0.85rem 0.7rem;
}
.points-history-title {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
}
.points-history-chart {
  display: block;
  width: 100%;
  height: auto;
  background: linear-gradient(180deg, #f7f4ef 0%, #fff 100%);
  border-radius: 8px;
  border: 1px solid #ebe6de;
}
.points-history-sum {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.15rem;
  border-top: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}
.settings-row-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.settings-row-title {
  font-weight: 600;
}
.settings-row-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}
.settings-row input {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.settings-row-slider {
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  cursor: default;
}
.settings-row-slider-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  cursor: pointer;
}
.settings-slider-value {
  flex-shrink: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.settings-row input.settings-range {
  width: 100%;
  height: 1.35rem;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(
      to right,
      var(--accent) 0 var(--rate-progress, 33.33%),
      var(--line) var(--rate-progress, 33.33%) 100%
    )
    center / 100% 0.35rem no-repeat;
  touch-action: none;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.settings-range::-webkit-slider-runnable-track {
  height: 0.35rem;
  border-radius: 999px;
  background: transparent;
}
.settings-range::-webkit-slider-thumb {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: -0.4rem;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--accent);
  -webkit-appearance: none;
}
.settings-range::-moz-range-track {
  height: 0.35rem;
  border-radius: 999px;
  background: var(--line);
}
.settings-range::-moz-range-progress {
  height: 0.35rem;
  border-radius: 999px;
  background: var(--accent);
}
.settings-range::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--accent);
}
.setup {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.15rem 1.1rem 1.35rem;
  margin-top: 1rem;
}
.setup h2 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
}
.setup .lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.setup .dict-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.setup .dict-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 0.4rem;
  background: #faf8f4;
}
.setup .dict-list .tag {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.setup .dict-list .tag.need {
  color: #9a3b00;
  font-weight: 700;
}
.setup .dict-list .tag.ok {
  color: #1a7a3c;
  font-weight: 700;
}
.pass-label {
  display: block;
  margin: 0.75rem 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.pass-label input {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  font: inherit;
  font-size: 1.15rem;
  padding: 0.75rem 0.85rem;
  border: 2px solid #c5bfb4;
  border-radius: 8px;
}
.pass-label input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}
.btn-primary {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 1rem 1.1rem;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--accent-press);
  transition: background 180ms ease-out;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn-primary:active {
  transform: translateY(1px);
  box-shadow: none;
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
}
.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-secondary {
  display: block;
  width: 100%;
  margin-top: 0.65rem;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 180ms ease-out;
}
.btn-secondary:hover:not(:disabled) {
  background: #eef4fa;
}
.btn-secondary:disabled {
  opacity: 0.55;
  cursor: wait;
}
.btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.history-study-btn:focus-visible,
.sheet-close:focus-visible,
.jump-tip:focus-visible,
.topbar .hist-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary.is-async-loading,
.btn-secondary.is-async-loading {
  position: relative;
  cursor: wait;
  opacity: 0.82;
}
.btn-primary.is-async-loading::before,
.btn-secondary.is-async-loading::before {
  content: "";
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.45em;
  vertical-align: -0.12em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: boot-status-spin 0.75s linear infinite;
}
.action-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px) + var(--pro-banner-height, 0px));
  transform: translateX(-50%) translateY(120%);
  z-index: 90;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1.35, 0.36, 1), opacity 0.28s ease;
}
.action-toast[hidden] {
  display: none !important;
}
.action-toast.show {
  display: block !important;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.action-toast-inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #c5ddd4;
  box-shadow: 0 12px 32px rgba(20, 61, 50, 0.16);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}
.action-toast-cat {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  background: url("/assets/cat-pixel/Cat-5/Cat-5-Meow.png") 0 0 / 200px 50px no-repeat;
  image-rendering: pixelated;
  animation: action-toast-cat-meow 0.8s steps(4) infinite;
}
@keyframes action-toast-cat-meow {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -200px 0;
  }
}
.action-toast-msg {
  flex: 1 1 auto;
}
.pro-shell.is-pro-busy .pro-live {
  color: var(--accent);
  font-weight: 700;
}
.pro-shell.is-pro-busy .pro-live::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.4em;
  vertical-align: -0.1em;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: boot-status-spin 0.75s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .btn-primary.is-async-loading::before,
  .btn-secondary.is-async-loading::before,
  .action-toast-cat,
  .pro-shell.is-pro-busy .pro-live::before {
    animation: none;
    opacity: 0.65;
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn-primary,
  .btn-secondary,
  .pro-text-link,
  .pro-float-banner,
  .pro-float-banner-slide {
    transition: none !important;
  }
}
.progress {
  height: 12px;
  background: #ddd;
  border-radius: 6px;
  overflow: hidden;
  margin: 0.85rem 0 0.5rem;
}
.progress > i {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.15s linear;
}

/* 起動・辞書準備中の控えめなトースト */
.boot-status {
  position: fixed;
  left: 50%;
  bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px) + var(--pro-banner-height, 0px));
  width: min(calc(100% - 2rem), 30rem);
  z-index: 85;
  transform: translateX(-50%) translateY(120%);
  padding: 0;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1.35, 0.36, 1), opacity 0.28s ease;
  pointer-events: none;
}
.boot-status[hidden] {
  display: none !important;
}
.boot-status.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.boot-status-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #c5ddd4;
  box-shadow: 0 8px 24px rgba(20, 61, 50, 0.12);
  text-align: left;
}
.boot-status-spinner {
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  border: 2px solid #d4ebe3;
  border-top-color: var(--accent, #1a5f4a);
  border-radius: 50%;
  animation: boot-status-spin 0.85s linear infinite;
}
.boot-status-spinner[hidden] {
  display: none !important;
}
.boot-status-brand {
  display: none;
}
.boot-status-msg {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text, #1a1a1a);
}
.boot-status.is-error .boot-status-card {
  border-color: #e8b4b4;
  box-shadow: 0 8px 24px rgba(120, 30, 30, 0.12);
}
.boot-status.is-error .boot-status-msg {
  color: #7a1f1f;
  font-size: 1rem;
  font-weight: 600;
}
@keyframes boot-status-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 層切替・Pro パック取得の工程カード */
.pack-transfer {
  margin: 0 0 0.85rem;
}
.pack-transfer[hidden] {
  display: none !important;
}
.pack-transfer-panel {
  padding: 1rem 1rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgba(20, 30, 40, 0.06);
}
.pack-transfer-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
}
.pack-transfer-lead {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}
.pack-transfer-lead[hidden] {
  display: none !important;
}
.pack-transfer-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.pack-step {
  display: grid;
  grid-template-columns: 1.35rem 1fr;
  gap: 0.65rem;
  align-items: start;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.pack-step-ind {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  border: 2px solid #c5c0b6;
  background: transparent;
  box-sizing: border-box;
}
.pack-step[data-status="pending"] {
  opacity: 0.72;
}
.pack-step[data-status="active"] {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}
.pack-step[data-status="active"] .pack-step-ind {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  animation: pack-step-pulse 1.2s ease-out infinite;
}
.pack-step[data-status="done"] .pack-step-ind {
  border-color: var(--accent);
  background: var(--accent);
  position: relative;
}
.pack-step[data-status="done"] .pack-step-ind::after {
  content: "";
  position: absolute;
  left: 0.28rem;
  top: 0.1rem;
  width: 0.28rem;
  height: 0.5rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pack-step[data-status="error"] {
  border-color: color-mix(in srgb, var(--wrong) 50%, var(--line));
  background: color-mix(in srgb, var(--wrong) 8%, var(--bg));
}
.pack-step[data-status="error"] .pack-step-ind {
  border-color: var(--wrong);
  background: var(--wrong);
}
.pack-step-body {
  min-width: 0;
}
.pack-step-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}
.pack-step-detail {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-word;
}
.pack-step-detail[hidden] {
  display: none !important;
}
.pack-step-bar {
  height: 8px;
  margin-top: 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 80%, #fff);
  overflow: hidden;
}
.pack-step-bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.15s linear;
}
.pack-step-bar[data-indeterminate="1"] > i {
  animation: pack-step-indeterminate 1.1s ease-in-out infinite;
}
@keyframes pack-step-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes pack-step-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
@media (prefers-reduced-motion: reduce) {
  .pack-step[data-status="active"] .pack-step-ind,
  .pack-step-bar[data-indeterminate="1"] > i {
    animation: none !important;
  }
}

#dlMsg {
  min-height: 1.4em;
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.install-panel {
  background: linear-gradient(180deg, #e8f1fb 0%, #fff 70%);
  border: 2px solid #9db7d4;
  border-radius: 10px;
  padding: 1.1rem;
  margin-top: 1rem;
}
.install-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}
.install-panel .lead {
  margin: 0 0 0.9rem;
  color: var(--muted);
}
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: max(1.15rem, calc(env(safe-area-inset-top, 0px) + 0.65rem)) 0.28rem
    calc(0.35rem + env(safe-area-inset-bottom, 0px));
  padding-left: max(0.28rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.28rem, env(safe-area-inset-right, 0px));
  overscroll-behavior: contain;
  touch-action: none;
}
.sheet .sheet-card,
.sheet .history-list,
.sheet .history-filters,
.sheet .history-index {
  touch-action: pan-y;
}
.sheet[hidden] { display: none !important; }
.sheet-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 14px 14px 10px 10px;
  padding: 1.2rem 1.1rem 1.3rem;
}
.sheet-card h3 { margin: 0 0 0.75rem; }
.history-card {
  --history-card-max-height: min(86vh, calc(100dvh - env(safe-area-inset-top, 0px) - 3.5rem));
  max-height: var(--history-card-max-height);
  display: flex;
  flex-direction: column;
  padding-bottom: 0.75rem;
  overflow: hidden;
}
/* リストシートは件数に関わらず常に最大高（フィルター切替時の上下ジャンプ防止） */
#historySheet .history-card {
  height: var(--history-card-max-height);
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  margin-left: -0.15rem;
  margin-right: -0.15rem;
  padding: 0.15rem 0.15rem 0.35rem;
}
.history-head h3 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  max-width: calc(100% - 5.2rem);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.history-head > .sheet-close {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}
.history-head-end {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}
.history-study-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.5rem;
  border: 1.5px solid var(--accent);
  border-radius: 0.45rem;
  background: linear-gradient(180deg, #eef4fa 0%, #e4edf6 100%);
}
.history-study-btn {
  flex: 1 1 auto;
  min-width: 4.5rem;
  border: 1.5px solid var(--accent);
  border-radius: 0.4rem;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.5rem 0.65rem;
  min-height: 2.75rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 1px 0 rgba(47, 93, 140, 0.18);
}
.history-study-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: none;
}
.history-study-btn:hover:not(:disabled),
.quiz-mode-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff;
}
#btnStudyPlay.active {
  position: relative;
  z-index: 1;
  border: 2px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(
      90deg,
      #ff1744,
      #ff9100,
      #ffea00,
      #00e676,
      #00b0ff,
      #651fff,
      #d500f9,
      #ff1744
    ) border-box;
  background-size: auto, 300% 100%;
  background-clip: padding-box, border-box;
  -webkit-background-clip: padding-box, border-box;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(213, 0, 249, 0.28), 0 0 4px rgba(255, 23, 68, 0.28);
  animation: hist-study-rainbow 1.8s linear infinite;
}
#btnStudyPlay.active::before {
  content: "再生学習";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: inherit;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(
    90deg,
    #ff1744,
    #ff9100,
    #ffea00,
    #00e676,
    #00b0ff,
    #651fff,
    #d500f9,
    #ff1744
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: hist-study-rainbow-text 1.8s linear infinite;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  #btnStudyPlay.active,
  #btnStudyPlay.active::before {
    animation: none;
  }
  #btnStudyPlay.active {
    background-position: 0% 50%, 40% 50%;
  }
  #btnStudyPlay.active::before {
    background-position: 40% 50%;
  }
}
.history-study-btn:active {
  transform: translateY(1px);
  opacity: 0.92;
}
.history-study-msg {
  flex: 1 1 100%;
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--wrong);
  line-height: 1.35;
}
.history-range-actions .history-study-btn {
  width: 100%;
}
.quiz-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}
.quiz-timer {
  position: relative;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  margin-left: 0;
}
.quiz-timer[hidden] {
  display: none !important;
}
.quiz-timer-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent) calc(var(--p, 100) * 1%),
    #e2ddd4 0
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4.5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4.5px), #000 calc(100% - 4px));
}
.quiz-timer.is-urgent .quiz-timer-ring {
  background: conic-gradient(
    var(--wrong) calc(var(--p, 100) * 1%),
    #e2ddd4 0
  );
}
.quiz-timer-sec {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  pointer-events: none;
}
.quiz-timer.is-urgent .quiz-timer-sec {
  color: var(--wrong);
}

.quiz-setup {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.35rem 0 0.5rem;
}
.quiz-setup[hidden],
.quiz-play[hidden],
.quiz-result[hidden] {
  display: none !important;
}
.quiz-setup-lead {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.quiz-mode-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.quiz-mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}
.quiz-mode-btn {
  min-width: 0;
  min-height: 2.75rem;
  padding-inline: 0.45rem;
  font-size: 0.88rem;
}
.quiz-setup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.quiz-setup-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}
.quiz-count-select {
  flex: 0 0 auto;
  min-width: 7.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.55rem 0.7rem;
  border-radius: 0.45rem;
  border: 1.5px solid var(--line, #d8d2c8);
  background: #fff;
  color: var(--text);
}

.quiz-setup-hint {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 0.45rem;
  background: #fff6e8;
  border: 1px solid #e8d2a8;
  color: #6a4a12;
  font-size: 0.86rem;
  line-height: 1.45;
}
.quiz-setup-hint[hidden] {
  display: none !important;
}
.quiz-count-select option:disabled {
  color: #aaa;
}
.quiz-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0 0.35rem;
  text-align: center;
}
.quiz-result-grade {
  margin: 0;
  font-size: clamp(3.2rem, 18vw, 4.6rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-shadow: 0 2px 0 rgba(47, 93, 140, 0.12);
}
.quiz-result-grade.is-ss,
.quiz-result-grade.is-s,
.quiz-result-grade.is-a {
  background: linear-gradient(120deg, #c9851a, #e2b23a 35%, #2f5d8c 70%, #6aa3d8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: quiz-grade-pop 0.7s cubic-bezier(0.2, 1.4, 0.3, 1) both;
}
.quiz-result-score {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}
.quiz-result-note {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.45;
}
.quiz-result .btn-primary,
.quiz-result .btn-secondary {
  width: min(100%, 16rem);
}
@keyframes quiz-grade-pop {
  0% { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.quiz-fx {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: hidden;
}
.quiz-fx[hidden] { display: none !important; }
.quiz-fx-burst {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 0;
  height: 0;
}
.quiz-fx-piece {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0;
  animation: quiz-fx-fly 1.15s ease-out forwards;
}
@keyframes quiz-fx-fly {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4); opacity: 0; }
}
.quiz-card.quiz-celebrate {
  animation: quiz-card-shine 1.1s ease-out;
}
@keyframes quiz-card-shine {
  0% { box-shadow: 0 0 0 0 rgba(226, 178, 58, 0); }
  35% { box-shadow: 0 0 0 6px rgba(226, 178, 58, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(226, 178, 58, 0); }
}

.quiz-meta {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.quiz-prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
.quiz-prompt {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}
.quiz-prompt-speak {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  min-height: 2.35rem;
  margin-top: 0.1rem;
  padding: 0 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.quiz-prompt-speak[hidden] {
  display: none !important;
}
.quiz-prompt-speak:active {
  background: #f3efe8;
}
.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.quiz-choice-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}
.quiz-choice {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  touch-action: manipulation;
}
.quiz-choice:active {
  background: #f3efe8;
}
.quiz-choice.is-correct {
  border-color: #2e7d32;
  background: #e8f5e9;
}
.quiz-choice.is-wrong {
  border-color: var(--wrong);
  background: #ffebee;
}
.quiz-choice:disabled {
  cursor: pointer;
  opacity: 1;
}
.quiz-choice.is-settled {
  cursor: pointer;
}
.quiz-choice-actions {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.28rem;
  flex: 0 0 auto;
}
.quiz-choice-actions[hidden] {
  display: none !important;
}
.quiz-choice-fav,
.quiz-choice-speak {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.quiz-choice-fav {
  opacity: 0.45;
}
.quiz-choice-fav.pinned {
  opacity: 1;
  border-color: #9db7d4;
  background: #e8f1fb;
}
.quiz-choice-speak:active,
.quiz-choice-fav:active {
  background: #f3efe8;
}
.quiz-explain {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf8f4;
  padding: 0.75rem 0.85rem;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.quiz-explain .quiz-explain-title {
  font-weight: 800;
  margin: 0 0 0.4rem;
}
.quiz-explain .quiz-explain-block {
  margin: 0.45rem 0 0;
}
.quiz-next {
  width: 100%;
  margin-top: 0.15rem;
}
.example-playback-card {
  width: min(420px, calc(100vw - 1.5rem));
  max-height: calc(
    100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.5rem
  );
  padding: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.example-playback-head-space {
  flex: 0 0 2rem;
  min-width: 2rem;
  min-height: 2rem;
}
.example-playback-setup,
.example-playback-play {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}
.example-playback-setup[hidden],
.example-playback-play[hidden] {
  display: none !important;
}
.example-playback-tip,
.example-playback-status,
.example-playback-error,
.example-playback-position,
.example-playback-label,
.example-playback-target,
.example-playback-example {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.example-playback-tip,
.example-playback-status,
.example-playback-error {
  line-height: 1.55;
}
.example-playback-tip,
.example-playback-label {
  color: var(--muted);
  font-size: 0.86rem;
}
.example-playback-status {
  font-weight: 700;
}
.example-playback-error {
  color: var(--wrong);
  font-weight: 700;
}
.example-playback-count-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.example-playback-count {
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.5rem 0.35rem;
}
.example-playback-count:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.example-playback-spinner {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0 auto;
  border: 2px solid var(--example-playback-spinner-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: boot-status-spin 0.85s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .example-playback-spinner {
    animation: none;
    border-top-color: currentColor;
  }
}
.example-playback-spinner[hidden] {
  display: none !important;
}
.example-playback-spinner:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.example-playback-setup-actions,
.example-playback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.example-playback-setup-actions .btn-secondary,
.example-playback-actions .btn-primary,
.example-playback-actions .btn-secondary {
  flex: 1 1 8rem;
  width: auto;
  min-width: 0;
  min-height: 2.75rem;
  margin-top: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
}
.example-playback-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.example-playback-actions .btn-primary,
.example-playback-actions .btn-secondary {
  width: 100%;
}
.example-playback-position {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 800;
}
.example-playback-target {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--example-playback-surface);
  font-size: 1.2rem;
  font-weight: 800;
}
.example-playback-target.is-speaking,
.example-playback-example.is-speaking {
  background-color: var(--example-playback-speaking-surface);
  background: color-mix(in srgb, var(--accent) 16%, var(--example-playback-surface));
  border-color: var(--accent);
}
.example-playback-example .tts-token {
  border-radius: 3px;
  transition: background-color 120ms ease, color 120ms ease;
}
.example-playback-example .tts-token.is-speaking {
  font-weight: 800;
  background-color: var(--example-playback-speaking-surface);
  background: color-mix(in srgb, var(--accent) 22%, var(--example-playback-surface));
  color: var(--text);
}
@media (prefers-reduced-motion: reduce) {
  .example-playback-example .tts-token {
    transition: none;
  }
}
@media (forced-colors: active) {
  .example-playback-target.is-speaking,
  .example-playback-example.is-speaking {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
  .example-playback-example .tts-token.is-speaking {
    outline: 2px solid Highlight;
    outline-offset: 1px;
    text-decoration: underline;
    text-decoration-thickness: 2px;
  }
}
.example-playback-example {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--example-playback-surface);
  max-height: min(9.5rem, 24vh);
  overflow-y: auto;
  line-height: 1.55;
  white-space: pre-wrap;
}
.example-playback-example a.dict-link {
  font-weight: 700;
}
.example-playback-example a.dict-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.history-head:active h3 {
  opacity: 0.55;
}
.sheet-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.sheet-close::before,
.sheet-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.625rem;
  height: 2px;
  margin: 0;
  border-radius: 1px;
  background: currentColor;
  pointer-events: none;
}
.sheet-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.sheet-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.sheet-close:active {
  background: #efeae3;
  border-color: color-mix(in srgb, var(--line) 55%, var(--text));
  color: var(--text);
}
.sheet-card > h3.sheet-title-tap {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.sheet-card > h3.sheet-title-tap:active {
  opacity: 0.55;
}
.history-body {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  gap: 0.1rem;
  overflow: visible;
}
.history-index {
  flex: 0 0 2rem;
  min-width: 2rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding: 0.15rem 0.45rem 0.15rem 0.1rem;
  margin-right: -0.2rem;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: pointer;
  z-index: 3;
  overflow: visible;
}
.history-index[hidden] { display: none !important; }
.history-index span {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
  transform-origin: left center;
  will-change: transform;
}
.history-index.magnifying span {
  transition: transform 0.05s linear;
}
@media (prefers-reduced-motion: reduce) {
  .history-index.magnifying span {
    transition: none;
  }
}
.history-index span.has {
  color: var(--accent);
}
.history-index-hud {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 5;
  min-width: 3.2rem;
  min-height: 3.2rem;
  padding: 0.35rem 0.55rem;
  border-radius: 12px;
  background: rgba(40, 36, 30, 0.82);
  color: #fff;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.history-index-hud[hidden] { display: none !important; }
.history-list {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
  margin: 0 -0.25rem 0 0;
  padding: 0 0.25rem 0.5rem;
}
.history-virt-spacer {
  position: relative;
  width: 100%;
  pointer-events: none;
}
.history-virt-window {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
  pointer-events: auto;
}
.history-item {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  height: 46px;
  margin-bottom: 6px;
  box-sizing: border-box;
}
.history-item.history-flip {
  will-change: transform;
  position: relative;
}
@media (prefers-reduced-motion: reduce) {
  .history-item.history-flip {
    transition: none !important;
    transform: none !important;
  }
}
.history-item .history-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf8f4;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-sizing: border-box;
}
.history-item .history-main:active { background: #f0ebe3; }
.history-item .word {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item .meta {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.history-item .history-del {
  flex-shrink: 0;
  width: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.history-item .history-del:active {
  background: #f0ebe3;
  color: var(--wrong);
}
.history-empty {
  color: var(--muted);
  padding: 1.5rem 0.5rem;
  text-align: center;
}
.sheet-steps {
  margin: 0 0 1.1rem;
  padding-left: 1.25rem;
  line-height: 1.7;
}
@media (max-width: 640px) {
  .x-head { font-size: 1.3rem; }
  .line-ex { margin-left: 0.5rem; }
  .topbar { flex-wrap: wrap; }
  .btn-primary { font-size: 1.25rem; padding: 1.15rem 1rem; }
}

.dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  z-index: 6;
  list-style: none;
  padding: 0;
  margin: 0;
}
.dropdown.open { display: block; }
.dropdown li {
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.dropdown li:hover,
.dropdown li.active { background: #f0ebe3; }
.dropdown .sec {
  font-size: 0.75rem;
  color: var(--muted);
  background: #f5f2ec;
  cursor: default;
}
.dropdown .sec:hover { background: #f5f2ec; }
.dropdown .drop-meta {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}
.dropdown li.pinned .drop-word {
  font-weight: 700;
}
.layout {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0.75rem 1rem 2.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}
.empty-launcher {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  min-height: min(34rem, calc(100dvh - 8rem));
  padding: 1rem 0.25rem 2rem;
}
.empty-launcher.install-panel {
  min-height: 0;
  padding: 1.1rem;
}
.empty-launcher[hidden] {
  display: none !important;
}
.empty-launcher-title {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}
.empty-launcher-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}
.empty-launcher-btn {
  min-width: 0;
  min-height: 6.25rem;
  padding: 1rem 0.75rem;
  border: 1.5px solid var(--accent);
  border-radius: 0.75rem;
  background: var(--paper);
  color: var(--accent);
  box-shadow: 0 2px 5px rgba(47, 93, 140, 0.12);
  cursor: pointer;
  font: inherit;
  font-size: clamp(1rem, 3.8vw, 1.2rem);
  font-weight: 800;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}
.empty-launcher-btn:hover {
  background: var(--accent);
  color: #fff;
}
.empty-launcher-btn:active {
  transform: translateY(1px);
}
.empty-launcher-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .empty-launcher-btn {
    transition: none;
  }
}
body.has-pro-banner .layout {
  padding-bottom: 2.5rem;
}
.article-wrap,
.article-deck {
  position: relative;
  margin-top: 0.9rem;
  overflow: hidden;
  touch-action: pan-y;
}
.article-wrap[hidden] {
  display: none !important;
}
.article-track {
  display: flex;
  flex-flow: row nowrap;
  align-items: flex-start;
  width: 100%;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}
.article-track.is-animating {
  transition: transform 0.48s cubic-bezier(0.22, 1.45, 0.36, 1);
}
.article-track.is-bounce {
  transition: transform 0.58s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.article-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
}
.article-slide-cur {
  z-index: 1;
}
.article-slide-prev,
.article-slide-next {
  z-index: 0;
  pointer-events: none;
  /* peek が中央より高いと .layout が無限スクロール相当になるのを防ぐ */
  max-height: var(--deck-h, none);
  overflow: hidden;
}
.article-slide.is-empty .article {
  opacity: 0.4;
  background: #f3f0ea;
  min-height: 8rem;
}
.article-slide.launcher-peek {
  max-height: none;
}
.article-slide.launcher-peek .launcher-peek-card {
  padding: 0;
  border: 0;
  background: transparent;
}
.article-slide.launcher-peek .empty-launcher {
  min-height: min(34rem, calc(100dvh - 8rem));
  margin: 0;
}
.article-slide.launcher-peek .empty-launcher-btn {
  pointer-events: none;
}
.article-peek {
  /* peek only — 操作は中央カード */
}
@media (prefers-reduced-motion: reduce) {
  .article-track.is-animating,
  .article-track.is-bounce {
    transition: none !important;
  }
}
.pin-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 4;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.pin-btn.pinned {
  opacity: 1;
  border-color: var(--accent);
  background: #e8f1fb;
}
.pin-btn:active {
  transform: scale(0.96);
}
.article {
  margin-top: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 2.6rem 1.4rem 1.1rem;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}
.article .not-found {
  margin: 0;
  padding: 0.15rem 0;
  width: 100%;
  text-align: center;
}
.article:has(> .not-found) {
  /* 検索バー下の表示領域をほぼ画面一杯に（スワイプしやすく） */
  min-height: calc(
    100dvh - 3.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.history-item.pinned .history-main {
  border-color: #9db7d4;
  background: #f3f7fc;
}
.history-item.study-play-current .history-main {
  border: 2px solid transparent;
  background:
    linear-gradient(#fff8f0, #fff8f0) padding-box,
    linear-gradient(
      90deg,
      #ff1744,
      #ff9100,
      #ffea00,
      #00e676,
      #00b0ff,
      #651fff,
      #d500f9,
      #ff1744
    ) border-box;
  background-size: auto, 300% 100%;
  background-clip: padding-box, border-box;
  -webkit-background-clip: padding-box, border-box;
  box-shadow: 0 0 10px rgba(213, 0, 249, 0.28), 0 0 4px rgba(255, 23, 68, 0.22);
  animation: hist-study-rainbow 1.8s linear infinite;
}
.history-item.study-play-current .history-main .word {
  background: linear-gradient(
    90deg,
    #ff1744,
    #ff9100,
    #ffea00,
    #00e676,
    #00b0ff,
    #651fff,
    #d500f9,
    #ff1744
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  animation: hist-study-rainbow-text 1.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .history-item.study-play-current .history-main,
  .history-item.study-play-current .history-main .word {
    animation: none;
  }
  .history-item.study-play-current .history-main {
    background-position: 0% 50%, 40% 50%;
  }
  .history-item.study-play-current .history-main .word {
    background-position: 40% 50%;
  }
}
.history-pin {
  flex-shrink: 0;
  width: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 0.45;
}
.history-pin.pinned {
  opacity: 1;
  border-color: #9db7d4;
  background: #e8f1fb;
}
.dict-card-body {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: none;
}
.article.multi {
  background: transparent;
  border: 0;
  padding: 0;
}
.article.multi .dict-card:first-child {
  padding-right: 2.6rem;
}
.dict-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.1rem 1.4rem;
  margin-bottom: 0.75rem;
}
.dict-card:last-child {
  margin-bottom: 0;
}
.dict-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.55rem;
}
a.dict-link {
  color: var(--tilde);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.pos-chip {
  display: inline;
  margin: 0 0.05rem;
  padding: 0.05rem 0.15rem;
  border: 0;
  border-bottom: 1px dashed var(--label);
  border-radius: 2px;
  background: transparent;
  color: var(--label);
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  cursor: pointer;
  vertical-align: baseline;
}
.pos-chip:active {
  background: #f3e8fb;
}
.pos-help-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  margin: 0;
  padding: 0.25rem 0.15rem 0.75rem;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.98rem;
  color: var(--text);
}
.jump-tip {
  position: fixed;
  z-index: 50;
  box-sizing: border-box;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}
.points-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px) + var(--pro-banner-height, 0px));
  transform: translateX(-50%) translateY(120%);
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.22, 1.4, 0.36, 1), opacity 0.35s ease;
}
.points-toast[hidden] {
  display: none !important;
}
.points-toast.show {
  display: block !important;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.points-toast-inner {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.7rem 1.1rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a3d 0%, #ff5cad 45%, #7b6cff 100%);
  color: #fff;
  font-weight: 800;
  box-shadow:
    0 10px 28px rgba(123, 108, 255, 0.35),
    0 0 0 3px rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}
.points-toast.pop .points-toast-inner {
  animation: points-pop 0.55s cubic-bezier(0.22, 1.6, 0.36, 1);
}
.points-star {
  font-size: 1.25rem;
  animation: points-spin 0.9s ease-out;
}
.points-delta {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}
.points-total {
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.95;
  padding-left: 0.35rem;
  border-left: 2px solid rgba(255, 255, 255, 0.45);
}
.points-bursts {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 0;
  height: 0;
  z-index: -1;
}
.points-burst {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1rem;
  animation: points-burst var(--bd, 0.7s) ease-out forwards;
  opacity: 0;
}
@keyframes points-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes points-spin {
  0% { transform: rotate(-20deg) scale(0.5); }
  60% { transform: rotate(12deg) scale(1.25); }
  100% { transform: rotate(0) scale(1); }
}
@keyframes points-burst {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0) scale(0.4);
  }
  20% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(var(--bx), var(--by)) rotate(var(--br)) scale(1.1);
  }
}
.x-head { font-size: 1.55rem; font-weight: 700; }
.x-homograph {
  font-size: 0.85rem;
  vertical-align: super;
  margin-left: 0.15rem;
  color: var(--muted);
}
.x-ipa,
.x-ipa-sup { color: var(--ipa); }
.x-ipa-sup { font-size: 0.75em; vertical-align: super; }
.x-label { color: var(--label); }
.x-em { font-weight: 700; }
.x-tilde {
  color: var(--tilde);
  font-style: italic;
  font-weight: 600;
}
.x-wrong { color: var(--wrong); font-weight: 700; }
.btn-sound {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  border: 0;
  background: #e8f1fb;
  color: #1e5a96;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.75rem;
  vertical-align: middle;
  cursor: pointer;
}
.line-main { margin: 0.35rem 0; }
.line-ex {
  margin: 0.15rem 0 0.15rem 1.25rem;
  padding-left: 0.5rem;
  border-left: 2px solid #e6e0d6;
  white-space: pre-wrap;
}
.line-ex .ex-hw {
  font-weight: 700;
  color: var(--text);
}
.box-usage,
.box-note {
  margin: 0.7rem 0 0.7rem 1.1rem;
  padding: 0.65rem 0.75rem;
  border: 1.5px solid var(--usage-border);
  background: var(--usage-bg);
  border-radius: 2px;
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.box-note {
  border-color: #666;
  background: #fafafa;
}
.empty,
.error,
.banner { margin-top: 1rem; color: var(--muted); }
.banner.update {
  background: #e8f1fb;
  border: 1px solid #9db7d4;
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  color: #123;
}

/* #googleTtsBlock 内、APIキー行（タイトル・説明・入力欄）をサブスクでは丸ごと隠す
   ラッパー。.settings-block と同じ縦並び+gapで、隠さないときは見た目を変えない。 */
#googleApiKeyRow {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
#googleApiKeyRow[hidden] {
  display: none;
}
.settings-block {
  border-top: 1px solid var(--line);
  padding: 0.85rem 0.15rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.settings-block[hidden] {
  display: none;
}
.settings-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.5rem;
}
.settings-actions .btn-primary,
.settings-actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  width: auto;
  margin-top: 0;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  box-shadow: none;
}
.settings-actions a.btn-primary,
.settings-actions a.btn-secondary {
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}
.settings-tag-pills {
  display: flex;
  flex-flow: row nowrap;
  align-items: stretch;
  gap: 0.4rem;
}
.settings-tag-pill {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.48rem 0.35rem;
  cursor: pointer;
  line-height: 1.25;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.settings-tag-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.settings-tag-pill:active {
  transform: scale(0.98);
}
.settings-theme-swatches {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.55rem;
}
.settings-theme-swatch {
  aspect-ratio: 1;
  width: 100%;
  max-width: 2.6rem;
  margin: 0 auto;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  -webkit-tap-highlight-color: transparent;
}
.settings-theme-swatch.active {
  border-color: var(--text);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.12),
    0 0 0 2px #fff,
    0 0 0 3px var(--text);
}
.settings-theme-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 360px) {
  .settings-theme-swatches {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .settings-actions .btn-primary,
  .settings-actions .btn-secondary {
    font-size: 0.95rem;
    padding: 0.55rem 0.7rem;
  }
  .settings-tag-pill {
    font-size: 0.78rem;
    padding: 0.48rem 0.25rem;
  }
}
.settings-hint {
  display: block;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}
.settings-hint.is-error {
  color: var(--wrong);
  font-weight: 700;
}
.settings-hint.is-ok {
  color: var(--ipa);
  font-weight: 700;
}
.settings-hint[hidden] { display: none !important; }

.settings-push-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0.35rem 0 0.15rem;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.35;
}
.settings-push-status[hidden] {
  display: none !important;
}
.settings-push-status-pill {
  flex: 0 0 auto;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ipa) 18%, #fff);
  border: 1px solid color-mix(in srgb, var(--ipa) 45%, var(--line));
  color: var(--ipa);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.settings-push-status-pill[hidden] {
  display: none !important;
}
.settings-push-status.is-active .settings-push-status-detail {
  color: var(--ipa);
  font-weight: 700;
}
.settings-push-status-detail {
  flex: 1 1 12rem;
  color: var(--muted);
}
.settings-actions .btn-primary[hidden],
.settings-actions .btn-secondary[hidden] {
  display: none !important;
}

.settings-select {
  max-width: 58%;
  min-width: 9rem;
  font: inherit;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
}
.settings-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
}
.settings-row-nested {
  margin: 0;
  padding: 0.35rem 0 0;
  border-top: 0;
}
.settings-footer {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
}
.settings-credits-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
}
.settings-credits-link:active {
  color: var(--accent);
}
.credits-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px) + var(--pro-banner-height, 0px));
  transform: translateX(-50%) translateY(120%);
  z-index: 60;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: auto;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22, 1.35, 0.36, 1), opacity 0.3s ease;
}
.credits-toast[hidden] {
  display: none !important;
}
.credits-toast.show {
  display: block !important;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.credits-toast-inner {
  padding: 0.85rem 1rem 0.95rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}
.credits-toast-inner p {
  margin: 0;
}
.credits-toast-title {
  font-weight: 700;
  margin-bottom: 0.35rem !important;
}
.credits-toast-inner p + p {
  margin-top: 0.45rem !important;
}

.quiz-word-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px) + var(--pro-banner-height, 0px));
  transform: translateX(-50%) translateY(120%);
  z-index: 70;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: auto;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1.35, 0.36, 1), opacity 0.25s ease;
}
.quiz-word-toast[hidden] {
  display: none !important;
}
.quiz-word-toast.show {
  display: block !important;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.quiz-word-toast-inner {
  padding: 0.75rem 0.95rem 0.85rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}
.quiz-word-toast-title {
  margin: 0 0 0.3rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--accent);
}
.quiz-word-toast-body {
  margin: 0;
  color: var(--text);
}

.level-tags {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0.35rem 0 0.15rem;
  vertical-align: middle;
}
.level-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.18rem 0.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.level-tag:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}
.cefr-tag {
  color: #fff;
}
.jp-level-tag {
  background: #fff;
}
.level-tag.band-1 { background: #4caf50; border-color: #3d8b40; }
.level-tag.band-2 { background: #8bc34a; border-color: #689f38; }
.level-tag.band-3 { background: #ffc107; border-color: #ffa000; color: #3a2e00; }
.level-tag.band-4 { background: #ff9800; border-color: #ef6c00; }
.level-tag.band-5 { background: #f44336; border-color: #c62828; }
.jp-level-tag.band-1 { color: #2e7d32; background: #e8f5e9; }
.jp-level-tag.band-2 { color: #558b2f; background: #f1f8e9; }
.jp-level-tag.band-3 { color: #f57f17; background: #fff8e1; }
.jp-level-tag.band-4 { color: #e65100; background: #fff3e0; }
.jp-level-tag.band-5 { color: #b71c1c; background: #ffebee; }
.corewo-tag {
  font-variant-numeric: tabular-nums;
}
.level-tag.corewo-tag.band-1 { color: #fff; background: #1565c0; border-color: #0d47a1; }
.level-tag.corewo-tag.band-2 { color: #fff; background: #1e88e5; border-color: #1565c0; }
.level-tag.corewo-tag.band-3 { color: #0d2137; background: #42a5f5; border-color: #1e88e5; }
.level-tag.corewo-tag.band-4 { color: #0d2137; background: #90caf9; border-color: #64b5f6; }
.level-tag.corewo-tag.band-5 { color: #1565c0; background: #e3f2fd; border-color: #90caf9; }


/* 下から放物線ポップイン / 閉じは逆再生的にフレームアウト */
.sheet {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.sheet.sheet-in {
  opacity: 1;
  pointer-events: auto;
}
.sheet.sheet-in .sheet-card {
  animation: sheet-arc-in 0.48s cubic-bezier(0.22, 1.35, 0.36, 1) both;
}
.sheet.sheet-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease;
}
.sheet.sheet-out .sheet-card {
  animation: sheet-arc-out 0.34s cubic-bezier(0.55, 0.05, 0.9, 0.35) both;
}
@keyframes sheet-arc-in {
  0% {
    transform: translate3d(0, 120%, 0) scale(0.94);
    opacity: 0.35;
  }
  58% {
    transform: translate3d(0, -4%, 0) scale(1.02);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
}
@keyframes sheet-arc-out {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 120%, 0) scale(0.94);
    opacity: 0.2;
  }
}
.jump-tip {
  transform-origin: 50% 100%;
  animation: tip-arc-in 0.42s cubic-bezier(0.22, 1.45, 0.36, 1) both;
}
.jump-tip.tip-out {
  animation: tip-arc-out 0.28s cubic-bezier(0.55, 0.05, 0.9, 0.4) both;
  pointer-events: none;
}
@keyframes tip-arc-in {
  0% {
    transform: translateY(36px) scale(0.72);
    opacity: 0;
  }
  55% {
    transform: translateY(-7px) scale(1.07);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@keyframes tip-arc-out {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(40px) scale(0.72);
    opacity: 0;
  }
}


.history-filters {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 0.65rem;
  max-height: 38vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 0 0 auto;
  min-height: 0;
}
.history-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.history-filter-label {
  flex: 0 0 auto;
  min-width: 4.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}
.history-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38rem 0.62rem;
  min-height: 2rem;
  cursor: pointer;
  line-height: 1.2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.history-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.history-tabs {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
}
.history-tab {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}
.history-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* —— オンボーディング —— */
.onboard {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: auto;
}
.onboard[hidden] { display: none !important; }
.onboard-dim {
  position: absolute;
  inset: 0;
  background: rgba(12, 28, 24, 0.55);
}
.onboard-spot {
  position: fixed;
  box-sizing: border-box;
  border-radius: 12px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(12, 28, 24, 0.55), 0 0 0 3px rgba(26, 95, 74, 0.55);
  background: transparent;
  pointer-events: none;
  transition: top 0.22s ease, left 0.22s ease, width 0.22s ease, height 0.22s ease;
  z-index: 1;
}
.onboard-spot[hidden] { display: none !important; }
.onboard.has-spot .onboard-dim { opacity: 0; }
.onboard-card {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: min(22rem, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.5rem);
  box-sizing: border-box;
  padding: 1rem 1.05rem 0.95rem;
  border-radius: 14px;
  background: #fffdf9;
  border: 1px solid #c5bfb4;
  box-shadow: 0 12px 36px rgba(20, 40, 34, 0.28);
  color: #143;
}
.onboard-progress {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent, #1a5f4a);
  letter-spacing: 0.02em;
}
.onboard-title {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.35;
  color: #123;
}
.onboard-body {
  margin: 0 0 0.9rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #345;
  white-space: pre-line;
}
.onboard-actions {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.onboard-actions .btn-primary,
.onboard-actions .btn-secondary {
  flex: 1 1 0;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  box-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
  .onboard-spot { transition: none; }
}

/* ---- Sprint 5: Pro インフロー・バー（1行ピル＋スライド訴求） ---- */
.pro-float-banner {
  flex: 0 0 auto;
  position: relative;
  z-index: 6;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.4rem 0.75rem;
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  padding-bottom: max(0.4rem, env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(26, 26, 26, 0.06);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pro-float-banner:hover {
  background: #fcfbf8;
}
.pro-float-banner:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
body.sheet-open .pro-float-banner {
  display: none !important;
}
.pro-float-banner-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.55rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--od-accent, #1a5f4a);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.pro-float-banner-viewport {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 1.35rem;
  overflow: hidden;
}
.pro-float-banner-slide {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(0);
  opacity: 1;
}
.pro-float-banner-slide.is-leave {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  transform: translateX(-40%);
  opacity: 0;
}
.pro-float-banner-slide.is-enter {
  transform: translateX(55%);
  opacity: 0;
}
.pro-float-banner-slide.is-enter-active {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  transform: translateX(0);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .pro-float-banner-slide.is-leave,
  .pro-float-banner-slide.is-enter,
  .pro-float-banner-slide.is-enter-active {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

.pro-page-body {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  color: var(--text);
}
.pro-shell {
  width: min(40rem, calc(100% - 1.5rem));
  max-width: 920px;
  margin: 0 auto;
  padding: max(0.85rem, env(safe-area-inset-top, 0px)) 0
    max(1.5rem, env(safe-area-inset-bottom, 0px));
}
.pro-test-env-badge {
  position: fixed;
  top: max(0.65rem, env(safe-area-inset-top, 0px));
  right: max(0.65rem, env(safe-area-inset-right, 0px));
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #e6b422;
  background: linear-gradient(135deg, #fff8e1 0%, #ffe082 100%);
  color: #6b4e00;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
  box-shadow: 0 4px 14px rgba(255, 193, 7, 0.28);
  pointer-events: none;
}
.pro-test-env-badge[hidden] {
  display: none !important;
}
.pro-test-env-badge-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #d4a017;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65);
  flex: 0 0 auto;
}
.pro-test-env-badge--warn {
  border-color: #e07a5f;
  background: linear-gradient(135deg, #fff0eb 0%, #ffd6cc 100%);
  color: #7a2e1a;
}
.pro-test-env-badge--warn .pro-test-env-badge-dot {
  background: #c0392b;
}
.pro-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.pro-account-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.35;
}
.pro-account-banner[hidden] {
  display: none !important;
}
.pro-account-banner-label {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: none;
}
.pro-account-banner-id {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1rem;
  font-weight: 800;
  word-break: break-all;
  color: var(--text);
}
.pro-account-banner-badge {
  flex: 0 0 auto;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.pro-account-banner-badge[hidden] {
  display: none !important;
}
.pro-account-signout {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}
.pro-account-signout[hidden] {
  display: none !important;
}
.pro-brand {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}
.pro-text-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 180ms ease-out;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.pro-text-link:hover {
  color: var(--accent-hover);
}
.pro-text-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pro-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.pro-title {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
}
.pro-lead {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--text);
}
.pro-price-status,
.pro-live {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.2em;
}
.pro-error {
  margin: 0 0 0.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--wrong);
  font-size: 0.9rem;
  font-weight: 700;
}
.pro-section {
  margin-top: 1.1rem;
}
.pro-h2 {
  margin: 0 0 0.65rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.pro-plan {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1rem 1.05rem;
  margin-bottom: 0.75rem;
}
.pro-plan-name {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.pro-plan-price {
  margin: 0 0 0.55rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.45rem;
}
.pro-plan-amount {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.pro-plan-tax {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.pro-plan-period {
  font-size: 0.9rem;
  color: var(--muted);
}
.pro-plan-points {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  color: var(--text);
  font-size: 0.95rem;
}
.pro-plan-points li {
  margin: 0.15rem 0;
}
.pro-plan-note {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}
.pro-plan .btn-primary {
  margin-top: 0.15rem;
}
.pro-account-status {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.pro-status {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  color: var(--text);
}
.pro-auth {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.pro-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.pro-field input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--chrome);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text);
  box-sizing: border-box;
}
.pro-field input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}
.pro-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.pro-auth-actions .btn-secondary,
.pro-portal-wrap .btn-secondary {
  margin-top: 0;
}
.pro-portal-wrap {
  margin-top: 0.85rem;
}
.pro-portal-lead {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.pro-restore-section {
  margin-top: 0.35rem;
}
.pro-restore-section > .btn-secondary {
  width: 100%;
}
body.pro-auth-toast-open {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
.pro-auth-toast-backdrop {
  position: fixed;
  inset: 0;
  z-index: 79;
  background: rgba(28, 25, 23, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.pro-auth-toast-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.pro-auth-toast-backdrop[hidden] {
  display: none !important;
}
.pro-auth-toast {
  position: fixed;
  left: 50%;
  bottom: var(--pro-toast-bottom, calc(1.25rem + env(safe-area-inset-bottom, 0px)));
  top: auto;
  transform: translateX(-50%) translateY(120%);
  z-index: 80;
  width: min(24rem, calc(100vw - 1.5rem));
  max-height: var(--pro-toast-max-h, min(85dvh, 32rem));
  pointer-events: auto;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1.35, 0.36, 1), opacity 0.25s ease, bottom 0.15s ease, max-height 0.15s ease;
}
.pro-auth-toast[hidden] {
  display: none !important;
}
.pro-auth-toast.show {
  display: flex !important;
  flex-direction: column;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.pro-auth-toast-inner {
  padding: 1rem 1rem 1.05rem;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  color: var(--text);
  max-height: inherit;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.pro-auth-toast-title {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}
.pro-auth-toast-body {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}
.pro-auth-toast-msg {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text);
}
.pro-auth-toast .pro-field {
  margin-bottom: 0.55rem;
}
.pro-auth-toast-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.pro-auth-toast-actions .btn-primary,
.pro-auth-toast-actions .btn-secondary {
  width: 100%;
  margin-top: 0;
}

.debug-logs-page-body {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  color: var(--text);
}
.debug-logs-page {
  width: min(52rem, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: max(0.85rem, env(safe-area-inset-top, 0px)) 0
    max(1.5rem, env(safe-area-inset-bottom, 0px));
}
.debug-logs-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.debug-logs-brand {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}
.debug-logs-title {
  margin: 0.25rem 0 0;
  font-size: 1.4rem;
  line-height: 1.35;
}
.debug-logs-lead,
.debug-logs-status,
.debug-logs-count {
  color: var(--muted);
}
.debug-logs-lead {
  margin: 0 0 0.8rem;
}
.debug-logs-status {
  min-height: 1.5em;
  margin: 0.8rem 0 0.35rem;
  font-weight: 700;
}
.debug-logs-count {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}
.debug-logs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.debug-logs-actions .btn-primary,
.debug-logs-actions .btn-secondary {
  flex: 1 1 10rem;
  width: auto;
  margin-top: 0;
}
.debug-logs-entry {
  margin: 0 0 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.debug-logs-entry-time {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.debug-logs-entry-events {
  margin: 0;
  max-width: 100%;
  padding: 0.7rem;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: auto;
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
