/* ===== App Shell ===== */
body {
  overscroll-behavior: none;
}

.app-shell {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  background: var(--color-bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
}

/* ===== Screen ===== */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--color-bg);
  padding-bottom: 64px; /* bottom-nav height */
}
.screen.is-active {
  display: flex;
}
.screen--no-nav {
  padding-bottom: 0;
}

/* ===== Scrollable body ===== */
.screen-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen-body--pad {
  padding: 16px;
}

/* ===== App Header (汎用) ===== */
.app-header {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
  flex-shrink: 0;
}
.app-header__title {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.app-header__sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text2);
  margin-left: 4px;
}
.app-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background: var(--color-surface2);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.back-btn .icon {
  font-size: var(--text-lg);
}
.back-btn:hover {
  background: var(--color-surface2);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-surface2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text2);
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  z-index: 10;
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
}
.bnav-item__pill {
  width: 44px;
  height: 30px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.bnav-item .icon {
  font-size: 22px;
  color: var(--color-muted);
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
}
.bnav-item__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-muted);
}
.bnav-item.is-active .bnav-item__pill {
  background: var(--color-green-t);
}
.bnav-item.is-active .icon {
  color: var(--color-green);
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
}
.bnav-item.is-active .bnav-item__label {
  color: var(--color-green);
  font-weight: 800;
}

/* ===== Toast ===== */
#toast-wrap {
  position: absolute;
  bottom: 96px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 500;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1a1a1a;
  color: #fff;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  animation: toastIn 0.24s ease-out;
  white-space: nowrap;
}

/* ===== Buttons ===== */
.btn-green {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-green);
  color: #fff;
  border: none;
  border-radius: var(--radius-2xl);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-ui);
  box-shadow: var(--shadow-btn-green);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s;
}
.btn-green:active {
  transform: translateY(2px);
  box-shadow: none;
}
.btn-green:disabled {
  background: var(--color-border);
  color: var(--color-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-orange {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-2xl);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-ui);
  box-shadow: var(--shadow-btn-orange);
  cursor: pointer;
  transition: transform 0.1s;
}
.btn-orange:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn-blue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-2xl);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-ui);
  box-shadow: var(--shadow-btn-blue);
  cursor: pointer;
  transition: transform 0.1s;
}
.btn-blue:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-ui);
  cursor: pointer;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-surface2);
  color: var(--color-text2);
  border: none;
  border-radius: var(--radius-2xl);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-ui);
  cursor: pointer;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-xl);
}
.btn-full {
  width: 100%;
}

/* ===== Level Badge ===== */
.lv-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}
.lv-badge--beginner {
  background: var(--level-beginner-bg);
  color: var(--level-beginner-fg);
}
.lv-badge--intermediate {
  background: var(--level-intermediate-bg);
  color: var(--level-intermediate-fg);
}
.lv-badge--advanced {
  background: var(--level-advanced-bg);
  color: var(--level-advanced-fg);
}

/* ===== Progress Bar (共通) ===== */
.prog-bar {
  height: 6px;
  background: var(--color-surface2);
  border-radius: 9999px;
  overflow: hidden;
}
.prog-bar__fill {
  height: 100%;
  background: var(--color-green);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* ===== Toggle ===== */
.toggle-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.toggle-input {
  display: none;
}
.toggle-track {
  width: 38px;
  height: 22px;
  background: var(--color-muted);
  border-radius: 9999px;
  position: relative;
  transition: background 0.2s;
}
.toggle-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s;
}
.toggle-input:checked + .toggle-track {
  background: var(--color-green);
}
.toggle-input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
}

/* ===== Segment Control ===== */
.seg-ctrl {
  display: flex;
  gap: 4px;
  background: var(--color-surface2);
  border-radius: var(--radius-lg);
  padding: 3px;
}
.seg-btn {
  padding: 5px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-ui);
  background: transparent;
  color: var(--color-text2);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.seg-btn.is-active {
  background: var(--color-green);
  color: #fff;
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  text-align: center;
}
.empty-state__icon {
  font-size: 88px;
  color: var(--color-muted);
}
.empty-state__title {
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text);
}
.empty-state__desc {
  font-size: 13px;
  color: var(--color-text2);
}

/* ===== Search Bar ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface2);
  border-radius: 9999px;
  padding: 8px 16px;
  flex: 1;
}
.search-bar__icon {
  color: var(--color-text2);
}
.search-bar__input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--color-text);
  outline: none;
  font-family: var(--font-ui);
}
.search-bar__input::placeholder {
  color: var(--color-muted);
}

/* ===== Bottom Sheet ===== */
.sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop.is-open {
  display: flex;
}
.sheet {
  background: var(--color-surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 430px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 85dvh;
  overflow-y: auto;
  animation: slideUp 0.26s ease;
  box-shadow: var(--shadow-sheet);
}
.sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--color-border);
  border-radius: 9999px;
  margin: 0 auto 16px;
}
.sheet__title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 16px;
}

/* ===== 聞き流し設定シート ===== */
.listen-sheet-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.listen-sheet-header__icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--color-green-t);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.listen-sheet-header__title {
  font-size: 17px;
  font-weight: 900;
}
.listen-sheet-header__sub {
  font-size: 12px;
  color: var(--color-text2);
  margin-top: 2px;
}
.listen-sheet-desc {
  background: var(--color-surface2);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--color-text2);
  line-height: 1.8;
  margin-bottom: 14px;
}
.listen-sheet-desc__label {
  font-weight: 800;
  color: var(--color-text);
}
.listen-sheet-section-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 8px;
}
.listen-mode-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.listen-mode-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: 0.15s;
}
.listen-mode-option.is-active {
  border-color: var(--color-green);
  background: var(--color-green-t);
}
.listen-mode-option__radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.listen-mode-option.is-active .listen-mode-option__radio {
  border-color: var(--color-green);
}
.listen-mode-option.is-active .listen-mode-option__radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-green);
}
.listen-mode-option__title {
  font-size: 14px;
  font-weight: 700;
}
.listen-mode-option__sub {
  font-size: 11px;
  color: var(--color-text2);
  margin-top: 2px;
}
.listen-sheet-start-btn {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  font-size: 15px;
  margin-bottom: 8px;
}
.listen-sheet-cancel-btn {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ===== S-01 Home ===== */
.home-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.home-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-header__title {
  font-size: 20px;
  font-weight: 900;
  color: var(--color-green);
}

/* Streak Hero Card */
.streak-card {
  background: #fff;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.week-cal {
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 80%;
}
.week-day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.week-day-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.week-day-circle--today {
  background: var(--color-green);
}
.week-day-circle--studied {
  background: var(--color-orange);
  color: var(--color-text-inverse);
}
.week-day-circle--empty {
  border: 1.5px solid var(--color-border);
}
.week-day-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text2);
}
.week-day-col--today .week-day-lbl {
  color: var(--color-green);
}
.week-day-today-label {
  color: var(--color-text-inverse);
  font-size: 11px;
  font-weight: 900;
}
.week-day-studied-label {
  font-size: 11px;
  font-weight: 900;
  color: var(--color-text-inverse);
}
.week-day-date {
  font-size: 10px;
  color: var(--color-muted);
}

.streak-num {
  font-size: 80px;
  font-weight: 900;
  color: var(--color-orange);
  line-height: 1;
  animation: streakPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.streak-label {
  font-size: 18px;
  font-weight: 900;
  color: var(--color-text);
}
.streak-sub {
  font-size: 12px;
  color: var(--color-text2);
}

/* 今日の目標カード */
.goal-card {
  background: var(--color-surface);
  border-radius: 16px;
  border: 1px solid var(--color-border);
  padding: 14px 16px;
  margin: 12px 16px 0;
}
.goal-card__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.goal-card__title {
  font-size: 13px;
  font-weight: 800;
  flex: 1;
}
.goal-card__value {
  font-size: 13px;
  color: var(--color-text2);
}
.goal-card__current {
  font-weight: 800;
  color: var(--color-green);
}
.goal-card__edit {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text2);
  display: flex;
}
.goal-bar {
  height: 10px;
  background: var(--color-surface2);
  border-radius: 9999px;
  overflow: hidden;
}
.goal-bar__fill {
  height: 100%;
  background: var(--color-green);
  border-radius: 9999px;
  transition: width 0.4s;
}

/* 設定バナー */
.setting-banner {
  background: var(--color-surface);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  padding: 12px 16px;
  margin: 12px 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.setting-banner__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-green-t);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setting-banner__body {
  flex: 1;
}
.setting-banner__label {
  font-size: 11px;
  color: var(--color-text2);
  margin-bottom: 4px;
}
.setting-banner__value {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* CTA */
.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-green);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 16px;
  font-size: 17px;
  font-weight: 800;
  font-family: var(--font-ui);
  box-shadow: var(--shadow-btn-green);
  cursor: pointer;
  margin: 12px 16px 0;
  width: calc(100% - 32px);
}
.cta-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* Stats row */
.stats-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding: 0 16px;
}
.stat-card {
  flex: 1;
  background: var(--color-surface2);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  padding: 12px 8px;
  text-align: center;
}
.stat-card__num {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}
.stat-card__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text2);
  margin-top: 4px;
}
.stat-card--green .stat-card__num {
  color: var(--color-green);
}
.stat-card--orange .stat-card__num {
  color: var(--color-orange);
}
.stat-card--muted .stat-card__num {
  color: var(--color-text2);
}

/* home body wrapper */
.screen-body .home-inner {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.ad-wrap {
  padding: 12px 16px 16px;
}

/* ===== S-02 Category ===== */
/* ===== S-02 Category Screen Header ===== */
.cat-screen-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.cat-screen-header__title-row {
  padding: 14px 20px 6px;
}
.cat-screen-header__title {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 2px;
}
.cat-screen-header__sub {
  font-size: 12px;
  color: var(--color-text2);
}
.lv-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 20px;
  overflow-x: auto;
}
.lv-tab {
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font-ui);
  color: var(--color-text2);
  white-space: nowrap;
  flex-shrink: 0;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: all 0.15s;
}
.lv-tab.is-active {
  background: var(--color-green);
  color: #fff;
  border-color: var(--color-green);
}
.lv-tab.is-active[data-level="intermediate"] {
  background: var(--color-orange);
  border-color: var(--color-orange);
}
.lv-tab.is-active[data-level="advanced"] {
  background: var(--color-red);
  border-color: var(--color-red);
}

/* レベル説明バナー */
.cat-level-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 20px 12px;
  border-radius: 10px;
  padding: 8px 12px;
  border: 1px solid;
  /* デフォルト: 初級 */
  background: #d4eeec;
  border-color: #c8e0de;
}
.cat-level-banner--intermediate {
  background: #fef3c7;
  border-color: #fcd34d;
}
.cat-level-banner--advanced {
  background: #fee2e2;
  border-color: #fca5a5;
}
.cat-level-banner__icon {
  font-size: 16px;
  flex-shrink: 0;
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 16;
  /* デフォルト: 初級 */
  color: #005c56;
}
.cat-level-banner--intermediate .cat-level-banner__icon {
  color: #92400e;
}
.cat-level-banner--advanced .cat-level-banner__icon {
  color: #991b1b;
}
.cat-level-banner__text {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  /* デフォルト: 初級 */
  color: #005c56;
}
.cat-level-banner--intermediate .cat-level-banner__text {
  color: #92400e;
}
.cat-level-banner--advanced .cat-level-banner__text {
  color: #991b1b;
}

/* コントロール行（習得済み含む + 表面切り替え） */
.cat-screen-header__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

/* トグル2 */
.toggle-track2 {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: var(--color-border);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-track2.is-on {
  background: var(--color-green);
}
.toggle-thumb2 {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: left 0.2s;
}
.toggle-track2.is-on .toggle-thumb2 {
  left: 18px;
}

/* セグメント2（小さめ） */
.seg-ctrl2 {
  display: flex;
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}
.seg-btn2 {
  padding: 5px 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--color-text2);
  transition: all 0.15s;
}
.seg-btn2.is-active {
  background: var(--color-green);
  color: #fff;
}

/* Category Card */
.cat-card {
  background: var(--color-surface);
  border-radius: 14px;
  border: 1px solid var(--color-border);
  padding: 11px 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cat-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--color-green-t);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}
.cat-card__body {
  flex: 1;
  min-width: 0;
}
.cat-card__name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}
.cat-card__name {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text);
}
.cat-card__word-cnt {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text2);
}
.cat-card__missed-badge {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--color-red-t);
  border-radius: 9999px;
  padding: 2px 6px;
  flex-shrink: 0;
}
.cat-card__missed-badge .icon {
  font-size: 11px;
  color: var(--color-red);
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 11;
}
.cat-card__missed-badge span:last-child {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-red);
}
.cat-card__prog-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cat-prog {
  flex: 1;
  height: 5px;
  background: var(--color-border);
  border-radius: 9999px;
  overflow: hidden;
}
.cat-prog__fill {
  height: 100%;
  background: var(--color-green);
  border-radius: 9999px;
  transition: width 0.5s;
}
.cat-card__prog-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-green);
  flex-shrink: 0;
}
.cat-card__actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

/* Skeleton */
.cat-skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
}
.skeleton-card {
  height: 120px;
  border-radius: 14px;
  background: linear-gradient(90deg, #e8f4f3 25%, #d4eeec 50%, #e8f4f3 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}

/* Error */
.cat-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.cat-error__icon-wrap {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  background: var(--color-red-t);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cat-error__title {
  font-size: 16px;
  font-weight: 800;
}
.cat-error__desc {
  font-size: 12px;
  color: var(--color-text2);
}

/* ===== S-03 Flashcard ===== */
.fc-header {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.fc-header .back-btn {
  border-radius: 10px;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.fc-progress-bar {
  flex: 1;
  height: 10px;
  background: var(--color-border);
  border-radius: 9999px;
  overflow: hidden;
}
.fc-progress-fill {
  height: 100%;
  background: var(--color-green);
  border-radius: 9999px;
  transition: width 0.4s;
}
.fc-counter {
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text2);
  white-space: nowrap;
  flex-shrink: 0;
}

.fc-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 20px 16px;
  overflow-y: auto;
}
.flip-scene {
  width: 100%;
  min-height: 50%;
  flex-shrink: 0;
  perspective: 1000px;
}
.flip-inner {
  width: 100%;
  min-height: 100%;
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.flip-inner.is-flipped {
  transform: rotateY(180deg);
}
.flip-face {
  grid-area: 1 / 1;
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  gap: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* 裏面は非表示時にグリッド高さに影響しないようvisibility:hiddenで隠す */
.flip-face.flip-front {
  visibility: visible;
}
.flip-inner.is-flipped .flip-front {
  visibility: hidden;
}
.flip-inner:not(.is-flipped) .flip-back {
  visibility: hidden;
}
.flip-front {
  background: #fffdf5;
  border: 2px solid #f0e8c8;
  box-shadow:
    rgba(0, 0, 0, 0.1) 0px 8px 32px,
    rgba(0, 0, 0, 0.06) 0px 2px 8px;
}
.flip-back {
  background: #f0fff4;
  border: 2px solid #c0edd0;
  box-shadow:
    rgba(88, 204, 2, 0.12) 0px 8px 32px,
    rgba(0, 0, 0, 0.06) 0px 2px 8px;
  transform: rotateY(180deg);
  padding: 20px;
  gap: 8px;
}

.fc-face-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.fc-face-label--front {
  color: #c8b560;
}
.fc-face-label--back {
  color: var(--color-green);
}

.fc-ko {
  font-family: var(--font-korean);
  font-size: 60px;
  font-weight: 900;
  color: var(--color-text);
  text-align: center;
  line-height: 1.15;
}
.fc-ja {
  font-family: var(--font-ja);
  font-size: 38px;
  font-weight: 900;
  color: var(--color-text);
  text-align: center;
  line-height: 1.2;
}
.fc-rd {
  font-family: var(--font-korean);
  font-size: 14px;
  color: var(--color-text);
  text-align: center;
}
.fc-hint {
  font-size: 12px;
  color: var(--color-muted);
}
.fc-back-hint {
  font-size: 12px;
  color: #a8c8b0;
  margin-top: 2px;
}

.fc-speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1.5px solid #e8dfb8;
  color: #c8a020;
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-ui);
  cursor: pointer;
}

.fc-ex-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border-top: 1.5px solid #d4eed8;
  padding-top: 10px;
  margin-top: 4px;
  justify-content: center;
}
.fc-ex-texts {
  flex: 1;
}
.fc-ex-ko {
  font-family: var(--font-korean);
  font-size: var(--text-2xl);
  color: var(--color-text);
}
.fc-ex-rd {
  font-size: var(--text-sm);
  color: #7b9;
  margin-top: 1px;
}
.fc-ex-ja {
  font-size: var(--text-base);
  color: var(--color-text);
  margin-top: 3px;
}
.fc-ex-speaker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 122, 114, 0.06);
  border: 1px solid rgba(0, 122, 114, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  color: var(--color-green);
}
.fc-ex-speaker.is-playing {
  background: rgba(0, 122, 114, 0.12);
}

.fc-answer {
  display: flex;
  gap: 12px;
  width: 100%;
}
.fc-answer.hidden {
  display: none;
}
.fc-answer.is-entering {
  animation: fadeUp 0.24s ease-out both;
}
.fc-btn-wrong {
  flex: 1;
  padding: 15px 0;
  background: var(--color-red-t);
  color: var(--color-red);
  border: 2px solid #ffcaca;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-ui);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.fc-btn-right {
  flex: 1;
  padding: 15px 0;
  background: var(--color-green);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-ui);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--color-green-d);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.fc-btn-right:active {
  transform: translateY(2px);
  box-shadow: none;
}

.fc-hint-row {
  text-align: center;
  font-size: 12px;
  color: var(--color-text2);
}
.fc-hint-row.hidden {
  display: none;
}

.fc-add-wb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 9999px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  color: var(--color-text2);
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: 0.2s;
}
.fc-add-wb.hidden {
  display: none;
}
.fc-add-wb:disabled {
  opacity: 0.5;
  cursor: default;
}

.fc-remaining {
  margin-top: auto;
  font-size: 12px;
  color: var(--color-text2);
}

/* card transition animations */
.fc-fade-out {
  animation: cardFadeOut 0.2s ease forwards;
}
.fc-fade-in {
  animation: cardFadeIn 0.2s ease forwards;
}

/* ===== S-04 Result ===== */
.result-score-wrap {
  text-align: center;
  padding: 24px 0 16px;
}
.result-score {
  font-size: 68px;
  font-weight: 900;
  line-height: 1;
}
.result-score--green {
  color: var(--color-green);
}
.result-score--orange {
  color: var(--color-orange);
}
.result-score--red {
  color: var(--color-red);
}
.result-score-sub {
  font-size: 13px;
  color: var(--color-text2);
  margin-top: 4px;
}
.result-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.result-stat {
  flex: 1;
  background: var(--color-surface);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.result-stat__num {
  font-size: 24px;
  font-weight: 900;
  color: var(--color-green);
  line-height: 1;
}
.result-stat__label {
  font-size: 11px;
  color: var(--color-text2);
  margin-top: 4px;
}
.result-missed-title {
  font-size: 14px;
  font-weight: 800;
  margin: 16px 0 8px;
}
.result-missed-list {
  background: var(--color-surface);
  border-radius: 12px;
  overflow: hidden;
}
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

/* ===== Word Item (共通) ===== */
.word-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}
.word-item:last-child {
  border-bottom: none;
}
.word-item__main {
  flex: 1;
  min-width: 0;
}
.word-item__ko {
  font-family: var(--font-korean);
  font-size: 20px;
  font-weight: 700;
}
.word-item__rd {
  font-size: 12px;
  color: var(--color-text2);
}
.word-item__ja {
  font-size: 14px;
  color: var(--color-text2);
  font-weight: 700;
}
.word-item__actions {
  display: flex;
  gap: 4px;
}
.word-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface2);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text2);
}
.badge-mastered {
  display: inline-flex;
  align-items: center;
  background: var(--color-green-t);
  color: var(--color-green-d);
  border-radius: 9999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
}

/* ===== S-05 Wordbook ===== */
.wb-action-bar {
  display: flex;
  gap: 10px;
  padding: 10px 16px 16px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* ===== S-07 Settings ===== */
.settings-section {
  margin-bottom: 24px;
}
.settings-section__title {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  padding: 0 4px;
}
.settings-group {
  background: var(--color-surface);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--color-surface);
}
.settings-item--col {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.settings-item__row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-item--border {
  border-top: 1px solid var(--color-border);
}
.settings-item__label {
  font-size: 14px;
  font-weight: 700;
}
.settings-item__desc {
  font-size: 12px;
  color: var(--color-text2);
  margin-top: 2px;
}

/* Goal stepper (設定画面) */
.goal-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.goal-stepper__btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text2);
  line-height: 1;
}
.goal-stepper__btn--plus {
  background: var(--color-green);
  border: none;
  color: #fff;
  box-shadow: 0 2px 0 #1b8a4a;
}
.goal-stepper__val {
  font-size: 18px;
  font-weight: 900;
  color: var(--color-green);
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ===== S-08 Listening ===== */
.listen-header {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
  flex-shrink: 0;
}
.listen-header__title {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.listen-loop-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 9999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
}
.listen-prog-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}
.listen-prog-fill {
  height: 100%;
  background: #fff;
  transition: width 0.4s;
}

.listen-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
}

.listen-playing-badge {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  background: var(--color-green-t);
  border-radius: 9999px;
  padding: 8px 16px;
  height: 40px;
}
.wave-bar {
  display: inline-block;
  width: 4px;
  background: var(--color-green);
  border-radius: 9999px;
}
.listen-pause-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-orange-t);
  color: var(--color-orange);
  border-radius: 9999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
}

.listen-ko {
  font-family: var(--font-korean);
  font-size: 54px;
  font-weight: 900;
  line-height: 1.2;
}
.listen-rd {
  font-family: var(--font-korean);
  font-size: 16px;
  color: var(--color-text2);
}
.listen-ja {
  font-size: 22px;
  font-weight: 900;
}
.listen-ex {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 12px 16px;
  width: 100%;
  text-align: left;
}
.listen-ex-ko {
  font-family: var(--font-korean);
  font-size: 14px;
  margin-bottom: 4px;
}
.listen-ex-ja {
  font-size: 12px;
  color: var(--color-text2);
}
.listen-counter {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text2);
}
.wake-banner {
  background: var(--color-orange-t);
  color: var(--color-orange);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
}

.listen-ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.listen-ctrl-sm {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-surface2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}
.listen-ctrl-play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 var(--color-green-d);
  color: #fff;
}
.listen-ctrl-play:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* ===== S-09 CatList ===== */
.cat-list-header {
  background: var(--color-surface);
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.cat-list-header__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--color-green-t);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.cat-list-header__name {
  font-size: 18px;
  font-weight: 800;
}
.cat-list-header__count {
  font-size: 13px;
  color: var(--color-text2);
}
.cat-list-header__actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.tab-bar {
  display: flex;
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-border);
  flex-shrink: 0;
}
.catlist-ex-toggle-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.catlist-ex-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.catlist-ex-toggle__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text2);
}
.tab-btn {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-ui);
  color: var(--color-text2);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.tab-btn.is-active {
  color: var(--color-green);
  border-bottom-color: var(--color-green);
}

/* Word row in catlist */
.word-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.word-row__num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--color-surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.word-row__num span {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-text2);
}
.word-row__main {
  flex: 1;
  min-width: 0;
}
.word-row__top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.word-row__ko {
  font-family: var(--font-korean);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}
.word-row__rd {
  font-size: 11px;
  color: var(--color-text2);
  letter-spacing: 0.5px;
}
.word-row__ja {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text2);
}
.word-row__btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-green-t);
  border: 1px solid var(--color-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.word-row__btn.wb-toggle--on {
  border-color: var(--color-orange);
  background-color: var(--color-orange);
}
.word-row__btn-icon {
  font-size: 15px;
  color: var(--color-green);
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 15;
}

.wb-toggle--on .word-row__btn-icon {
  color: var(--color-text-inverse);
}

.word-row__btn.sr-add--on {
  border-color: var(--color-orange);
  background-color: var(--color-orange);
}
.sr-add--on .word-row__btn-icon {
  color: var(--color-text-inverse);
}

.word-row--has-ex {
  cursor: pointer;
}
.word-row__expand {
  display: none;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--color-border);
}
.word-row.is-expanded .word-row__expand {
  display: block;
}
.word-row__ex-ko {
  font-family: var(--font-korean);
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 2px;
}
.word-row__ex-ja {
  font-size: 12px;
  color: var(--color-text2);
}

/* ===== Sheet: Word Detail ===== */
.sheet-word-ko {
  font-family: var(--font-korean);
  font-size: 40px;
  font-weight: 900;
  margin-bottom: 4px;
}
.sheet-word-rd {
  font-size: 14px;
  color: var(--color-text2);
  margin-bottom: 12px;
}
.sheet-speak-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text2);
  margin-bottom: 12px;
}
.sheet-word-ja {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 16px;
}
.sheet-example {
  border-left: 3px solid var(--color-green);
  padding-left: 12px;
  margin-bottom: 16px;
  background: var(--color-surface2);
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.sheet-example__ko {
  font-family: var(--font-korean);
  font-size: 13px;
  margin-bottom: 4px;
}
.sheet-example__ja {
  font-size: 12px;
  color: var(--color-text2);
}

/* ===== Transfer Code ===== */
.transfer-code {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.3em;
  text-align: center;
  color: var(--color-green);
  padding: 16px 0;
  font-family: monospace;
}

/* ===== Redeem Input ===== */
.redeem-input {
  width: 100%;
  font-size: 28px;
  text-align: center;
  letter-spacing: 0.3em;
  padding: 12px;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  outline: none;
  font-family: monospace;
  transition: border-color 0.15s;
}
.redeem-input.has-error {
  border-color: var(--color-red);
  background: #fff5f5;
}
.redeem-error {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-red-t);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--color-red);
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}

/* ===== Safe area ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .screen {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .screen--no-nav {
    padding-bottom: 0;
  }
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(64px + env(safe-area-inset-bottom));
  }
}

/* ===== shimmer ===== */
@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}
