/* v3.8.8 mobile-only fast training: lighter site-style layout, no duplicated top/bottom actions */
.mobile-live-entry { display: none; }
.mobile-live-page { min-height: 40vh; }
.mobile-live-desktop-note {
  max-width: 680px;
  margin: 48px auto;
  padding: 28px;
  border-radius: 28px;
  background: var(--card-bg, var(--card));
  box-shadow: var(--shadow);
}
.mobile-live-desktop-note h1 { margin: 8px 0 10px; font-size: clamp(24px, 3vw, 34px); }
.mobile-live-shell { display: none; }

@media (max-width: 820px) {
  body:not([data-page="/mobile-train"]) .mobile-live-entry {
    position: fixed;
    right: 14px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    z-index: 80;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    color: #fff;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: .02em;
    background: linear-gradient(145deg, var(--brand), var(--brand-2));
    box-shadow: 0 14px 28px rgba(22, 120, 95, .26);
    border: 1px solid rgba(255, 255, 255, .36);
  }

  html, body { overflow-x: hidden; }
  body[data-page="/mobile-train"] {
    width: 100%;
    max-width: 100%;
    color: var(--text);
    background:
      radial-gradient(circle at 14% 0%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 34%),
      radial-gradient(circle at 92% 5%, color-mix(in srgb, var(--brand-2) 10%, transparent), transparent 28%),
      linear-gradient(180deg, var(--bg-soft), var(--bg));
    overscroll-behavior: none;
  }

  body[data-page="/mobile-train"] .app-header,
  body[data-page="/mobile-train"] .bottom-nav,
  body[data-page="/mobile-train"] .mobile-live-entry { display: none !important; }

  body[data-page="/mobile-train"] .main.container {
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .mobile-live-page {
    width: 100vw;
    min-height: 100svh;
    margin: 0;
  }

  .mobile-live-desktop-note { display: none; }

  .mobile-live-shell {
    display: block;
    width: 100%;
    max-width: 480px;
    min-height: 100svh;
    margin: 0 auto;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(98px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-live-topbar {
    margin: 0 0 10px;
    padding: 14px;
    border-radius: 24px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 64%, #fff 36%), color-mix(in srgb, var(--card) 84%, transparent));
    border: 1px solid color-mix(in srgb, var(--brand) 16%, var(--line));
    box-shadow: 0 12px 26px rgba(25, 72, 54, .07);
  }

  .mobile-live-clockbox { min-width: 0; }
  .mobile-live-clockline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-live-timer {
    display: inline-block;
    color: var(--brand);
    font-size: clamp(52px, 15.2vw, 70px);
    line-height: .9;
    font-weight: 950;
    letter-spacing: -.06em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .mobile-live-timer-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255,255,255,.82);
    box-shadow: 0 10px 18px rgba(25, 72, 54, .08);
    font-size: 15px;
    font-weight: 950;
  }
  .mobile-live-timer-toggle::before { content: "▶"; margin-right: 6px; font-size: 10px; transform: translateY(-1px); }
  .mobile-live-timer-toggle.is-running { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; }
  .mobile-live-timer-toggle.is-running::before { content: "Ⅱ"; font-size: 12px; }

  .mobile-live-topbar span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-live-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin: 0 0 10px;
  }

  .mobile-live-summary > div,
  .mobile-live-minimize {
    min-height: 58px;
    border-radius: 18px;
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(226,235,229,.96);
    box-shadow: 0 10px 20px rgba(25, 72, 54, .06);
  }

  .mobile-live-minimize,
  .mobile-live-summary > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    text-decoration: none;
  }
  .mobile-live-summary strong { color: var(--text); font-size: 22px; line-height: 1; font-weight: 950; font-variant-numeric: tabular-nums; }
  .mobile-live-summary span { color: var(--muted); font-size: 12px; font-weight: 850; }

  .mobile-live-plan-strip {
    margin: 0 0 10px;
    padding: 12px;
    border-radius: 22px;
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(226,235,229,.96);
    box-shadow: 0 12px 24px rgba(25, 72, 54, .07);
  }
  .mobile-live-plan-strip > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
  .mobile-live-plan-strip strong { color: var(--text); font-size: 14px; font-weight: 950; }
  .mobile-live-plan-strip span { color: var(--muted); font-size: 12px; font-weight: 800; }
  .mobile-live-plan-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .mobile-live-plan-scroll::-webkit-scrollbar { display: none; }
  .mobile-live-plan-chip {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 132px;
    max-width: 180px;
    min-height: 56px;
    padding: 10px 12px;
    border-radius: 16px;
    color: var(--text);
    background: var(--card-soft);
    border: 1px solid var(--line);
  }
  .mobile-live-plan-chip span { overflow: hidden; color: inherit; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; font-weight: 950; }
  .mobile-live-plan-chip small { overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; font-size: 11px; font-weight: 800; }
  .mobile-live-plan-chip.active { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 44%, var(--line)); }
  .mobile-live-plan-chip.done { opacity: .55; }

  .mobile-live-card {
    display: block;
    margin: 0;
    padding: 14px;
    border: 1px solid rgba(226,235,229,.96);
    border-radius: 26px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 14px 32px rgba(25, 72, 54, .08);
    backdrop-filter: blur(12px);
  }

  .mobile-live-action-head {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    margin-bottom: 13px;
  }

  .mobile-live-art {
    display: flex;
    width: 70px;
    height: 70px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 22px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 8px 16px rgba(25, 72, 54, .07);
  }
  .mobile-live-art-fallback { color: var(--brand); font-size: 28px; font-weight: 950; }

  .mobile-live-art img,
  .mobile-live-art svg,
  .mobile-live-art .exercise-img,
  .mobile-live-art .category-icon-img {
    display: block;
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    object-fit: contain;
    margin: auto;
  }

  .mobile-live-action-title small,
  .mobile-live-action-title span,
  .mobile-live-selector label span,
  .mobile-live-note,
  .mobile-live-empty { color: var(--muted); }
  .mobile-live-action-title small { display: block; margin-bottom: 3px; font-size: 11px; font-weight: 900; }
  .mobile-live-action-title strong { display: block; overflow: hidden; color: var(--text); white-space: nowrap; text-overflow: ellipsis; font-size: 24px; line-height: 1.12; font-weight: 950; }
  .mobile-live-action-title span { display: block; margin-top: 4px; font-size: 12px; font-weight: 800; }

  .mobile-live-ghost {
    display: inline-flex;
    min-width: 64px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
    text-decoration: none;
    font-size: 13px;
    font-weight: 950;
  }

  .mobile-live-selector { display: grid; grid-template-columns: 1fr 1.28fr .68fr; gap: 8px; margin-bottom: 10px; }
  .mobile-live-selector label,
  .mobile-live-note,
  .mobile-live-custom-fields label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; font-weight: 900; }

  .mobile-live-selector select,
  .mobile-live-custom-fields select,
  .mobile-live-custom-fields input,
  .mobile-live-note textarea,
  .mobile-live-set-list input,
  .mobile-live-set-list select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--text);
    background: #fff;
    font: inherit;
    font-weight: 900;
    outline: none;
  }
  .mobile-live-selector select,
  .mobile-live-custom-fields select,
  .mobile-live-custom-fields input,
  .mobile-live-note textarea { padding: 0 12px; }
  .mobile-live-selector select:focus,
  .mobile-live-custom-fields select:focus,
  .mobile-live-custom-fields input:focus,
  .mobile-live-note textarea:focus,
  .mobile-live-set-list input:focus,
  .mobile-live-set-list select:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); border-color: color-mix(in srgb, var(--brand) 48%, var(--line)); }

  .mobile-live-custom-fields { display: none; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 10px; }
  body.show-custom[data-page="/mobile-train"] .mobile-live-custom-fields { display: grid; }
  body.show-custom[data-page="/mobile-train"] .mobile-live-custom-fields .custom-only:first-child { grid-column: 1 / -1; }

  .mobile-live-insight {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 4px 0 12px;
    padding: 12px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg-soft) 62%, #fff 38%);
    border: 1px solid var(--line);
  }
  .mobile-live-insight strong { color: var(--text); font-size: 14px; font-weight: 950; }
  .mobile-live-insight p, .mobile-live-insight span { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; font-weight: 750; }
  .mobile-live-insight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .mobile-live-insight-grid span { min-width: 0; padding: 9px 8px; border-radius: 14px; background: rgba(255,255,255,.86); border: 1px solid var(--line); }
  .mobile-live-insight-grid b { display: inline-block; color: var(--text); font-size: 18px; font-weight: 950; font-variant-numeric: tabular-nums; }
  .mobile-live-insight-grid small { margin-left: 3px; color: var(--muted); font-size: 10px; font-weight: 800; }
  .mobile-live-insight-grid em { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-style: normal; font-weight: 850; }

  .mobile-live-entry-panel,
  .mobile-live-rest,
  .mobile-live-saved {
    margin: 0 0 12px;
    padding: 12px;
    border-radius: 22px;
    background: rgba(255,255,255,.74);
    border: 1px solid var(--line);
  }
  .mobile-live-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
  .mobile-live-panel-head strong { color: var(--text); font-size: 17px; font-weight: 950; }
  .mobile-live-panel-head span { color: var(--muted); font-size: 11px; font-weight: 850; }

  .mobile-live-set-list { display: grid; gap: 9px; }
  .mobile-live-set-list .set-head { display: none; }
  .mobile-live-set-list .set-row-with-type[data-set-row] {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) 42px;
    grid-template-areas:
      "idx type remove"
      "weight reps rpe";
    gap: 8px;
    align-items: center;
    padding: 10px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 8px 18px rgba(25, 72, 54, .05);
  }
  .mobile-live-set-list .set-index { grid-area: idx; display: flex; width: 50px; height: 46px; align-items: center; justify-content: center; border-radius: 16px; color: var(--brand); background: var(--brand-soft); font-size: 19px; font-weight: 950; }
  .mobile-live-set-list .set-type-select { grid-area: type; }
  .mobile-live-set-list input[name="set_weight"] { grid-area: weight; }
  .mobile-live-set-list input[name="set_reps"] { grid-area: reps; }
  .mobile-live-set-list input[name="set_rpe"] { grid-area: rpe; }
  .mobile-live-set-list .remove-set { grid-area: remove; }
  .mobile-live-set-list input,
  .mobile-live-set-list select { height: 46px; min-height: 46px; padding: 0 8px; text-align: center; font-size: 15px; }
  .mobile-live-set-list select { text-align-last: center; }
  .mobile-live-set-list input[name="set_weight"],
  .mobile-live-set-list input[name="set_reps"] { color: var(--brand); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 26%, var(--line)); font-size: 18px; font-weight: 950; }
  .mobile-live-set-list input[name="set_weight"]::placeholder,
  .mobile-live-set-list input[name="set_reps"]::placeholder { color: color-mix(in srgb, var(--brand) 56%, var(--muted)); }
  .mobile-live-set-list input[name="set_rpe"] { font-size: 14px; }
  .mobile-live-set-list .remove-set { display: flex; width: 42px; height: 46px; align-items: center; justify-content: center; border: 1px solid rgba(227, 62, 80, .22); border-radius: 15px; color: #d93548; background: rgba(255, 240, 242, .72); font-size: 22px; font-weight: 950; }

  .mobile-live-type-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 11px 0; }
  .mobile-live-rpe { display: flex; min-height: 40px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 15px; background: #fff; font-size: 13px; font-weight: 950; }
  .mobile-live-rpe::before { content: ""; width: 12px; height: 12px; margin-right: 6px; border: 3px solid currentColor; border-radius: 999px; }
  .mobile-live-rpe.easy { color: #36b24a; }
  .mobile-live-rpe.normal { color: #d99518; }
  .mobile-live-rpe.hard { color: #e33e50; }
  .mobile-live-rpe.active { background: color-mix(in srgb, currentColor 10%, #fff); }
  .mobile-live-rpe.active::before { background: currentColor; box-shadow: inset 0 0 0 3px #fff; }

  .mobile-live-actions-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .mobile-live-small-btn { min-height: 44px; border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: #fff; font-size: 12px; font-weight: 950; }
  .mobile-live-small-btn.primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }

  .mobile-live-rest { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center; }
  .mobile-live-rest > div:first-child span { display: block; color: var(--muted); font-size: 12px; font-weight: 900; }
  .mobile-live-rest > div:first-child strong { display: block; margin-top: 2px; color: var(--brand); font-size: 36px; line-height: 1; font-weight: 950; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
  .mobile-live-rest > div:first-child small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
  .mobile-live-rest-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .mobile-live-rest-actions button,
  .mobile-live-rest-presets button { min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--text); font-size: 12px; font-weight: 950; }
  .mobile-live-rest-actions button:first-child { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
  .mobile-live-rest-actions button:first-child.is-running { background: linear-gradient(135deg, #d99518, #f0b142); }
  .mobile-live-rest-presets { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .mobile-live-rest-presets button.active { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--brand-soft); }

  .mobile-live-saved { scroll-margin-bottom: 110px; }
  .mobile-live-record-table { overflow: hidden; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
  .mobile-live-record-head,
  .mobile-live-record-row { display: grid; grid-template-columns: .44fr .9fr .96fr .68fr .68fr .82fr; gap: 4px; align-items: center; padding: 9px 8px; }
  .mobile-live-record-head { color: var(--muted); background: var(--card-soft); font-size: 11px; font-weight: 900; }
  .mobile-live-record-row { border-top: 1px solid var(--line); color: var(--text); font-size: 12px; font-weight: 850; font-variant-numeric: tabular-nums; }
  .mobile-live-record-row .type { color: var(--brand); font-weight: 950; }
  .mobile-live-empty { margin: 0; padding: 12px; border-radius: 16px; background: #fff; border: 1px dashed var(--line); font-size: 12px; line-height: 1.5; font-weight: 750; }

  .mobile-live-note { margin: 0 0 12px; }
  .mobile-live-note textarea { min-height: 66px; padding-top: 11px; resize: vertical; }

  .mobile-live-submit-row { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .mobile-live-save { min-height: 54px; border: 0; border-radius: 17px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 12px 24px color-mix(in srgb, var(--brand) 20%, transparent); font-size: 17px; font-weight: 950; }

  .mobile-live-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: 1fr 1.06fr 1fr;
    gap: 10px;
    max-width: 480px;
    margin: 0 auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent, rgba(245, 250, 247, .92) 20%, rgba(245, 250, 247, .98) 100%);
    backdrop-filter: blur(18px);
    border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  }
  .mobile-live-dock a {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border-radius: 20px;
    color: var(--muted);
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(226,235,229,.96);
    box-shadow: 0 12px 24px rgba(25, 72, 54, .07);
    text-decoration: none;
    font-size: 12px;
    font-weight: 900;
  }
  .mobile-live-dock b { display: flex; width: 30px; height: 28px; align-items: center; justify-content: center; font-size: 22px; line-height: 1; }
  .mobile-live-dock .main b,
  .mobile-live-dock .finish b { width: 44px; height: 44px; border-radius: 999px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 12px 24px color-mix(in srgb, var(--brand) 28%, transparent); }
  .mobile-live-dock .main span,
  .mobile-live-dock .finish span { color: var(--brand); font-weight: 950; }
}

@media (max-width: 390px) {
  .mobile-live-shell { padding-left: 10px; padding-right: 10px; }
  .mobile-live-timer { font-size: clamp(48px, 14.5vw, 62px); }
  .mobile-live-timer-toggle { min-width: 72px; min-height: 40px; padding: 0 12px; }
  .mobile-live-action-head { grid-template-columns: 62px minmax(0, 1fr) auto; gap: 9px; }
  .mobile-live-art { width: 62px; height: 62px; border-radius: 19px; }
  .mobile-live-art img, .mobile-live-art svg, .mobile-live-art .exercise-img, .mobile-live-art .category-icon-img { width: 54px !important; height: 54px !important; max-width: 54px !important; max-height: 54px !important; }
  .mobile-live-action-title strong { font-size: 21px; }
  .mobile-live-ghost { min-width: 58px; }
  .mobile-live-selector { grid-template-columns: 1fr 1.18fr .64fr; }
  .mobile-live-selector select { padding: 0 8px; font-size: 13px; }
  .mobile-live-actions-row { grid-template-columns: 1fr; }
  .mobile-live-record-head,
  .mobile-live-record-row { grid-template-columns: .42fr .82fr .95fr .62fr .62fr; }
  .mobile-live-record-head span:last-child,
  .mobile-live-record-row span:last-child { display: none; }
  .mobile-live-dock { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .mobile-live-dock a { min-height: 62px; }
}

html[data-theme="dark"] body[data-page="/mobile-train"] {
  background:
    radial-gradient(circle at 14% 0%, rgba(104, 213, 170, .13), transparent 34%),
    radial-gradient(circle at 92% 5%, rgba(138, 232, 194, .08), transparent 28%),
    linear-gradient(180deg, #101b16 0%, #0e1713 100%);
}
html[data-theme="dark"] .mobile-live-topbar,
html[data-theme="dark"] .mobile-live-card,
html[data-theme="dark"] .mobile-live-plan-strip,
html[data-theme="dark"] .mobile-live-summary > div,
html[data-theme="dark"] .mobile-live-entry-panel,
html[data-theme="dark"] .mobile-live-rest,
html[data-theme="dark"] .mobile-live-saved,
html[data-theme="dark"] .mobile-live-dock a { background: rgba(22, 35, 29, .92); border-color: rgba(43, 68, 56, .92); }
html[data-theme="dark"] .mobile-live-dock { background: linear-gradient(180deg, transparent, rgba(16,27,22,.88) 20%, rgba(16,27,22,.98) 100%); }
html[data-theme="dark"] .mobile-live-selector select,
html[data-theme="dark"] .mobile-live-custom-fields select,
html[data-theme="dark"] .mobile-live-custom-fields input,
html[data-theme="dark"] .mobile-live-note textarea,
html[data-theme="dark"] .mobile-live-set-list input,
html[data-theme="dark"] .mobile-live-set-list select,
html[data-theme="dark"] .mobile-live-set-list .set-row-with-type[data-set-row],
html[data-theme="dark"] .mobile-live-rpe,
html[data-theme="dark"] .mobile-live-small-btn,
html[data-theme="dark"] .mobile-live-rest-actions button,
html[data-theme="dark"] .mobile-live-rest-presets button,
html[data-theme="dark"] .mobile-live-record-table,
html[data-theme="dark"] .mobile-live-empty { background: rgba(18, 31, 25, .96); }
