:root {
  color-scheme: light;
  --blue: #0879e8;
  --blue-dark: #0457ad;
  --blue-soft: #e5f3ff;
  --blue-pale: #f4faff;
  --ink: #081a2b;
  --muted: #607487;
  --line: #cde1f2;
  --surface: #ffffff;
  --danger: #e94a56;
  --warning: #d68a00;
  --radius: 22px;
  --shadow: 0 12px 35px rgb(7 74 135 / 11%);
  --app-safe-top: env(safe-area-inset-top, 0px);
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Trebuchet MS", Inter, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgb(8 121 232 / 13%), transparent 24rem),
    linear-gradient(180deg, #f7fbff 0%, #edf7ff 100%);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: calc(80px + var(--app-safe-top));
  padding: var(--app-safe-top) clamp(16px, 4vw, 58px) 0;
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(8 121 232 / 16%);
  background: rgb(255 255 255 / 91%);
  box-shadow: 0 5px 20px rgb(7 74 135 / 7%);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; border: 0; padding: 0; color: inherit; background: transparent; text-align: left; }
.brand b, .brand small { display: block; }
.brand b { color: var(--blue-dark); font-size: 20px; line-height: 1; letter-spacing: .08em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.brand-mascot {
  width: 58px;
  height: 58px;
  overflow: hidden;
  display: grid;
  place-items: start center;
  border: 3px solid #fff;
  border-radius: 19px;
  background: var(--blue-soft);
  box-shadow: 0 5px 13px rgb(8 121 232 / 22%);
  transform: rotate(-3deg);
}
.brand-mascot img { width: 80px; margin-top: -3px; animation: mascot-bob 2.6s ease-in-out infinite; }
@keyframes mascot-bob { 50% { transform: translateY(-2px) rotate(2deg); } }
.top-actions { display: flex; align-items: center; gap: 13px; }
.account-entry { display: flex; align-items: center; gap: 8px; }
.top-auth-button { min-height: 38px; padding: 0 13px; border: 2px solid var(--line); border-radius: 13px; color: var(--blue-dark); background: #fff; box-shadow: 0 4px 0 rgb(4 87 173 / 11%); font-size: 12px; font-weight: 900; white-space: nowrap; }
.top-auth-button.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.saved { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.saved i { width: 8px; height: 8px; border-radius: 50%; background: #18b866; box-shadow: 0 0 0 4px rgb(24 184 102 / 12%); }
.saved.cloud i { background: var(--blue); box-shadow: 0 0 0 4px rgb(8 121 232 / 12%); }
.avatar, .icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

main { max-width: 1320px; min-height: calc(100vh - 80px); margin: auto; padding: 34px clamp(16px, 4vw, 58px) 122px; }
.page-head {
  min-height: 255px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding: clamp(24px, 4vw, 44px);
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 74% 20%, rgb(255 255 255 / 16%), transparent 15rem),
    linear-gradient(125deg, #041c35 0%, #075da9 55%, #0c91f0 100%);
  box-shadow: 0 18px 45px rgb(4 87 173 / 24%);
}
.page-head::before, .page-head::after {
  content: "";
  position: absolute;
  border: 2px solid rgb(255 255 255 / 12%);
  border-radius: 50%;
}
.page-head::before { width: 240px; height: 240px; right: 15%; top: -130px; }
.page-head::after { width: 340px; height: 340px; right: -150px; bottom: -250px; }
.page-copy { z-index: 1; max-width: 680px; display: flex; flex-direction: column; align-items: start; justify-content: center; }
.page-head .actions { z-index: 3; position: relative; display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.hero-mascot { z-index: 1; width: min(36%, 340px); min-width: 220px; position: relative; align-self: end; pointer-events: none; }
.hero-mascot img { width: 100%; max-height: 278px; display: block; object-fit: contain; object-position: center top; filter: drop-shadow(0 14px 16px rgb(0 0 0 / 20%)); }
.hero-mascot span {
  position: absolute;
  z-index: 2;
  top: 4px;
  right: auto;
  left: -8px;
  padding: 8px 11px;
  border: 3px solid var(--ink);
  border-radius: 14px 14px 14px 2px;
  color: var(--ink);
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 12px;
  font-weight: 900;
  transform: rotate(4deg);
}
.eyebrow { margin: 0 0 8px; color: #81cbff; font-size: 11px; font-weight: 900; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 11px; font-size: clamp(38px, 6vw, 70px); line-height: .93; letter-spacing: -.06em; }
h2 { margin-bottom: 6px; color: var(--ink); letter-spacing: -.035em; }
h3 { margin-bottom: 5px; }
.page-head .muted { max-width: 520px; margin-bottom: 0; color: #d7edff; font-size: 15px; }
.muted { color: var(--muted); }

.button {
  min-height: 44px;
  padding: 0 17px;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: var(--blue-dark);
  background: #fff;
  box-shadow: 0 4px 0 rgb(4 87 173 / 13%);
  font-weight: 900;
  transition: transform .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgb(4 87 173 / 13%); }
.button.primary { border-color: #fff; color: var(--blue-dark); background: #fff; }
.card .button.primary, dialog .button.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.button.ghost { border-color: rgb(255 255 255 / 42%); color: #fff; background: rgb(255 255 255 / 10%); }
.card .button.ghost, dialog .button.ghost { border-color: var(--line); color: var(--blue-dark); background: var(--blue-pale); }
.button.danger { color: var(--danger); }
.button.small { min-height: 35px; padding: 0 11px; font-size: 11px; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.card {
  grid-column: span 12;
  padding: 21px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card.s4 { grid-column: span 4; } .card.s5 { grid-column: span 5; } .card.s6 { grid-column: span 6; } .card.s7 { grid-column: span 7; } .card.s8 { grid-column: span 8; } .card.s12 { grid-column: span 12; }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.card-head p { margin-bottom: 0; }
.add-schema-button { flex-shrink: 0; }
.stat {
  min-height: 155px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.stat::after { content: ""; width: 74px; height: 74px; position: absolute; right: -18px; top: -20px; border-radius: 50%; background: var(--blue-soft); }
.stat strong { display: block; color: var(--blue-dark); font-size: 34px; letter-spacing: -.05em; }
.stat span { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.track { height: 9px; overflow: hidden; border-radius: 12px; background: var(--blue-soft); }
.track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-dark), #30a9ff); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 99px; color: var(--blue-dark); background: var(--blue-soft); font-size: 10px; font-weight: 900; white-space: nowrap; }
.badge.good { color: #087443; background: #dcf9eb; }
.badge.bad { color: #b52f3c; background: #ffe4e7; }
.badge.warn { color: #8c5a00; background: #fff1cf; }

.list { display: grid; gap: 10px; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 13px;
  border: 2px solid #e2eef8;
  border-radius: 15px;
  background: var(--blue-pale);
  transition: border-color .15s ease, transform .15s ease;
}
.item:hover { border-color: #9dccf2; transform: translateX(2px); }
.item.selected-item { border-color: var(--blue); background: #eaf6ff; box-shadow: inset 4px 0 0 var(--blue); }
.item-main { flex: 1; min-width: 0; }
.item-main strong, .item-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.item-actions { display: flex; gap: 5px; }
.item-actions button { min-width: 42px; min-height: 34px; padding: 0 8px; border: 2px solid var(--line); border-radius: 10px; color: var(--blue-dark); background: #fff; font-size: 11px; font-weight: 900; }
.item-actions button:hover { border-color: var(--blue); background: var(--blue-soft); }
.item-actions button.danger { color: var(--danger); }
.item-actions button.danger:hover { border-color: var(--danger); background: #ffe4e7; }
.empty { padding: 30px 16px; border: 2px dashed #b8d7ef; border-radius: 15px; color: var(--muted); background: var(--blue-pale); text-align: center; }
.empty b { display: block; margin-bottom: 4px; color: var(--ink); }

.segmented { width: fit-content; display: flex; gap: 4px; margin-bottom: 20px; padding: 5px; border: 2px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.segmented button { padding: 10px 17px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 900; }
.segmented button.active { color: #fff; background: var(--blue); }
.exercise-editor { grid-column: 1 / -1; display: grid; gap: 8px; }
.exercise-row { display: grid; grid-template-columns: 1fr 80px 90px 34px; gap: 7px; }
.exercise-row input { min-width: 0; }
.exercise-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.exercise-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 15px; border: 2px solid #d9ecfb; border-radius: 16px; background: var(--blue-pale); }
.exercise-card strong { display: block; margin-bottom: 3px; }
.exercise-card p { margin-bottom: 10px; }
.exercise-card-actions { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.exercise-card-actions .button { width: 100%; }
.exercise-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.exercise-meta span { padding: 4px 7px; border-radius: 999px; color: var(--blue-dark); background: #fff; font-size: 10px; font-weight: 900; }
.full-logbook summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.full-logbook summary::-webkit-details-marker { display: none; }
.full-logbook summary::after { content: "+"; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; color: #fff; background: var(--blue); font-weight: 900; }
.full-logbook[open] summary::after { content: "-"; }
.full-logbook summary strong, .full-logbook summary small { display: block; }
.full-logbook summary small { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.session-panel { margin-top: 18px; padding: 16px; border: 2px solid #d9ecfb; border-radius: 18px; background: #fff; }
.session-panel h3 { color: var(--blue-dark); }
.session-empty { display: grid; gap: 12px; align-items: start; }
.session-progress { display: grid; gap: 8px; margin-bottom: 12px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--blue-pale); }
.session-progress strong { color: var(--blue-dark); }
.last-log { display: block; margin-top: 7px; color: var(--blue-dark); font-size: 11px; font-weight: 800; white-space: normal; }
.session-status-note { display: inline-flex; width: fit-content; margin-top: 7px; padding: 4px 8px; border-radius: 999px; color: var(--blue-dark); background: #e4f4ff; font-size: 10px; font-weight: 900; }
.session-status-note.good { color: #057047; background: #dff8ec; }
.session-status-note.warn { color: #9a5b00; background: #fff0c9; }
.session-status-note.bad { color: #b42335; background: #ffe5e8; }
.session-actions .primary-action { border-color: var(--blue); color: #fff; background: var(--blue); }
.session-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.session-list { gap: 8px; }
.session-item.done { background: #effcf6; border-color: #bcebd4; }
.session-item.skipped { background: #fff3f4; border-color: #ffd1d6; }
.session-item.pending { background: #fffaf0; border-color: #ffe2a8; }
.sheet-session-modal { display: grid; gap: 14px; }
.sheet-modal-actions { display: flex; justify-content: flex-end; }
.sheet-session-modal > .muted { margin-bottom: 0; }
.modal-exercise-grid { margin-bottom: 0; }
.wish-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.wish-card { overflow: hidden; padding: 0; }
.wish-image { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: cover; background: var(--blue-soft); }
.wish-body { padding: 18px; }
.wish-body p { min-height: 38px; font-size: 12px; }

.table-wrap { overflow-x: auto; border: 2px solid #e2eef8; border-radius: 15px; }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
th { color: var(--blue-dark); background: var(--blue-soft); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.logbook-filters { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 10px; }
.logbook-filters label { display: grid; gap: 6px; color: var(--blue-dark); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.logbook-filters input, .logbook-filters select { width: 100%; padding: 12px 13px; border: 2px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--blue-pale); }
.mini-chart { height: 180px; display: flex; align-items: end; gap: 8px; padding: 22px 4px 28px; border: 2px solid #e2eef8; border-radius: 15px; background: var(--blue-pale); }
.mini-bar { flex: 1; min-width: 18px; position: relative; border-radius: 8px 8px 3px 3px; background: linear-gradient(to top, var(--blue-dark), #3fb3ff); opacity: .88; }
.mini-bar:hover { opacity: 1; }
.mini-bar span { width: max-content; max-width: 80px; overflow: hidden; position: absolute; left: 50%; bottom: -23px; transform: translateX(-50%); color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.mini-bar b { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); color: var(--blue-dark); font-size: 9px; white-space: nowrap; }
.exercise-progress-card h3 { margin-bottom: 10px; color: var(--blue-dark); font-size: 15px; }
.backup-actions { display: grid; gap: 10px; }
.backup-card .button.ghost { color: var(--blue-dark); background: var(--blue-pale); }.chart { height: 180px; display: flex; align-items: end; gap: 8px; padding-top: 20px; }
.bar { flex: 1; min-width: 15px; position: relative; border-radius: 8px 8px 3px 3px; background: linear-gradient(to top, var(--blue-dark), #3fb3ff); opacity: .85; }
.bar:hover { opacity: 1; }
.bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 9px; white-space: nowrap; }

.bottom-nav {
  width: min(650px, calc(100% - 24px));
  height: 74px;
  position: fixed;
  z-index: 6;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  padding: 7px;
  border: 2px solid #b9d9f2;
  border-radius: 24px;
  background: rgb(255 255 255 / 95%);
  box-shadow: 0 16px 40px rgb(4 87 173 / 20%);
  backdrop-filter: blur(18px);
  pointer-events: auto;
}
.bottom-nav button { display: grid; place-items: center; align-content: center; gap: 3px; border: 0; border-radius: 16px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 900; pointer-events: auto; touch-action: manipulation; }
.bottom-nav button i { display: grid; place-items: center; min-width: 25px; height: 25px; font-style: normal; font-size: 17px; line-height: 1; }
.bottom-nav button.active { color: #fff; background: var(--blue); box-shadow: 0 5px 12px rgb(8 121 232 / 28%); }

dialog {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px - var(--app-safe-top) - var(--app-safe-bottom));
  margin: auto;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
}
dialog::backdrop { background: rgb(3 19 34 / 66%); backdrop-filter: blur(5px); }
#modalForm {
  max-height: inherit;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 2px solid #a8d0ed;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 25px 70px rgb(0 0 0 / 25%);
}
#modalForm header, #modalForm footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px; }
#modalForm header { border-bottom: 2px solid var(--line); background: var(--blue-pale); }
.modal-message { flex: 0 0 auto; margin: 14px 20px 0; padding: 12px 14px; border: 2px solid #9bd2ff; border-radius: 14px; color: var(--blue-dark); background: #e8f5ff; font-size: 12px; font-weight: 900; box-shadow: 0 8px 18px rgb(8 121 232 / 12%); }
[hidden] { display: none !important; }
.modal-message[hidden] { display: none; }
dialog.hide-close #modalClose { display: none !important; }
#modalForm header h2 { margin: 0; }
#modalForm section { overflow: auto; min-height: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; padding: 20px; -webkit-overflow-scrolling: touch; }
#modalForm footer { justify-content: end; border-top: 2px solid var(--line); }
#modalForm footer[hidden] { display: none; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--blue-dark); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.field input, .field textarea, .field select { width: 100%; padding: 12px 13px; outline: 0; border: 2px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--blue-pale); }
.field textarea { min-height: 95px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgb(8 121 232 / 11%); background: #fff; }
.password-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.password-wrap button { min-height: 44px; padding: 0 12px; border: 2px solid var(--line); border-radius: 12px; color: var(--blue-dark); background: #fff; font-size: 11px; font-weight: 900; }
.generator-panel { padding: 14px; border: 2px solid #d9ecfb; border-radius: 17px; background: #fff; }
.generator-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 10px; }
.generator-control { display: grid; gap: 5px; color: var(--blue-dark); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.generator-control.hidden { display: none; }
.generator-control select { width: 100%; }
.generator-actions { display: flex; justify-content: flex-end; gap: 9px; align-items: center; }
.generator-preview { margin-top: 10px; padding: 11px; border: 2px dashed #bedcf2; border-radius: 13px; background: var(--blue-pale); }
.generator-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.generator-preview p { margin-bottom: 0; }
.generator-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.generator-preview-card { display: grid; gap: 4px; padding: 10px; border: 2px solid #dcecf8; border-radius: 12px; background: #fff; }
.generator-preview-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.generator-safety { margin: 10px 0 0; font-size: 11px; }
.generator-preview-card strong, .generator-preview-card span, .generator-preview-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.generator-preview-card span { color: var(--muted); font-size: 11px; }
.generator-preview-card small { color: var(--blue-dark); font-size: 10px; font-weight: 900; }
.sheet-builder, .library-picker { padding: 14px; border: 2px solid #d9ecfb; border-radius: 17px; background: var(--blue-pale); }
.builder-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.builder-head label, .builder-head .hint { display: block; }
.selected-exercises { display: grid; gap: 9px; }
.selected-exercise-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 96px auto; gap: 8px; align-items: end; padding: 12px; border: 2px solid #dcecf8; border-radius: 14px; background: #fff; }
.selected-exercise-row strong, .selected-exercise-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-exercise-row span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.selected-exercise-row label { gap: 4px; }
.selected-exercise-row input { padding: 9px 10px; }
.selected-exercise-actions { display: flex; gap: 6px; }
.selected-exercise-actions button, .library-card-actions button { min-height: 34px; padding: 0 9px; border: 2px solid var(--line); border-radius: 10px; color: var(--blue-dark); background: #fff; font-size: 11px; font-weight: 900; }
.library-toolbar { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.library-info { margin: 10px 0; padding: 11px; border: 2px dashed #bedcf2; border-radius: 13px; background: #fff; }
.library-info p { margin-bottom: 6px; font-size: 12px; }
.library-info-card strong { display: block; margin-bottom: 6px; color: var(--blue-dark); }
.library-results { max-height: 370px; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding-right: 2px; }
.library-exercise-card { display: grid; gap: 10px; padding: 12px; border: 2px solid #dcecf8; border-radius: 14px; background: #fff; }
.library-exercise-card strong { display: block; margin-bottom: 6px; }
.library-card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.library-card-meta span { padding: 4px 7px; border-radius: 999px; color: var(--blue-dark); background: var(--blue-soft); font-size: 9px; font-weight: 900; }
.library-card-actions { display: flex; gap: 7px; align-items: center; justify-content: space-between; }
.library-card-actions .button[disabled] { opacity: .65; cursor: default; }
.advanced-exercises.hidden { display: none; }
.readonly-info { padding: 6px 0; }
.readonly-info p { margin-bottom: 10px; }
.exercise-instruction {
  margin: 12px 0 14px;
  padding: 9px;
  border: 2px solid #d9ecfb;
  border-radius: 16px;
  background: #fff;
}
.exercise-instruction img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}
.hint { color: var(--muted); font-size: 10px; }
.consent-panel p { margin-bottom: 12px; }
.consent-actions { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.auth-copy { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.auth-inline-action { margin-top: -8px; text-align: right; }
.auth-inline-action button, .auth-switch button, .auth-local-link button { min-height: auto; padding: 0; border: 0; color: var(--blue-dark); background: transparent; font: inherit; font-size: 12px; font-weight: 900; text-decoration: underline; box-shadow: none; cursor: pointer; }
.auth-switch { display: flex; justify-content: center; gap: 6px; align-items: center; padding-top: 8px; border-top: 1px solid #d9ecfb; color: var(--muted); font-size: 13px; }
.auth-local-link { text-align: center; }
.auth-requirements { margin: -4px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.account-panel { padding: 16px; border: 2px solid var(--line); border-radius: 18px; background: var(--blue-pale); }
.account-panel p { display: grid; gap: 5px; margin: 0 0 14px; }
.account-panel span { color: var(--muted); }
.confirmation-panel { border-color: rgb(24 139 232 / 35%); background: #fff; }
.confirmation-panel b { color: var(--blue-dark); }
.confirmation-panel .account-actions { grid-template-columns: 1fr; }
.account-actions .button[disabled] { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.account-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.account-actions .button { width: 100%; }
.feedback-button { position: fixed; right: 18px; bottom: 104px; z-index: 7; min-height: 42px; padding: 0 14px; border: 2px solid #fff; border-radius: 999px; color: #fff; background: var(--blue-dark); box-shadow: var(--shadow); font-size: 11px; font-weight: 900; }
#toast { position: fixed; z-index: 20; top: calc(92px + var(--app-safe-top)); right: 18px; padding: 12px 16px; border: 2px solid #fff; border-radius: 13px; color: #fff; background: var(--blue); box-shadow: var(--shadow); font-size: 12px; font-weight: 900; transform: translateX(calc(100% + 30px)); transition: transform .2s ease; }
#toast.show { transform: translateX(0); }

@media (max-width: 920px) {
  .card.s4, .card.s5, .card.s7, .card.s8 { grid-column: span 6; }
  .wish-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-mascot { width: 36%; min-width: 190px; }
}
@media (max-width: 650px) {
  .topbar { height: calc(68px + var(--app-safe-top)); }
  .brand-mascot { width: 48px; height: 48px; border-radius: 15px; }
  .brand-mascot img { width: 66px; }
  .brand b { font-size: 17px; }
  .saved, .brand small { display: none; }
  .top-actions { gap: 7px; }
  .account-entry { gap: 6px; }
  .top-auth-button { min-height: 36px; padding: 0 10px; border-radius: 12px; font-size: 11px; }
  main { padding: 18px 13px 108px; }
  .page-head { min-height: 255px; padding: 24px 20px; border-radius: 23px; }
  .page-copy { max-width: 68%; justify-content: start; }
  .page-head h1 { font-size: clamp(35px, 11vw, 52px); }
  .page-head .muted { font-size: 12px; }
  .page-head .actions { width: calc(100vw - 58px); margin-top: 16px; padding-right: 34%; }
  .page-head .actions .button { flex: 1 1 100%; min-width: 130px; }
  .hero-mascot { width: 43%; min-width: 145px; position: absolute; right: -17px; bottom: 0; }
  .hero-mascot img { max-height: 210px; }
  .hero-mascot span { display: none; }
  .card.s4, .card.s5, .card.s6, .card.s7, .card.s8 { grid-column: span 12; }
  .card { padding: 17px; border-radius: 18px; }
  .card-head { align-items: stretch; flex-direction: column; }
  .card-head .add-schema-button { width: 100%; }
  .wish-grid { grid-template-columns: 1fr; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1; white-space: nowrap; }
  dialog {
    width: calc(100% - 20px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px - var(--app-safe-top) - var(--app-safe-bottom));
  }
  @supports not (height: 100dvh) {
    dialog { max-height: calc(100svh - 20px - var(--app-safe-top) - var(--app-safe-bottom)); }
  }
  #modalForm { border-radius: 20px; }
  #modalForm header, #modalForm footer { padding: 14px 16px; }
  .modal-message { margin: 12px 16px 0; }
  #modalForm header h2 { font-size: clamp(24px, 8vw, 34px); line-height: 1.05; }
  #modalForm section { grid-template-columns: 1fr; padding: 16px; }
  .field.full { grid-column: auto; }
  .exercise-row { grid-template-columns: 1fr 58px 68px 32px; }
  .exercise-grid { grid-template-columns: 1fr; }
  .builder-head { align-items: stretch; flex-direction: column; }
  .library-toolbar, .library-results, .selected-exercise-row, .generator-grid, .generator-preview-grid, .logbook-filters { grid-template-columns: 1fr; }
  .library-results { max-height: min(320px, 38dvh); }
  .generator-actions { justify-content: stretch; }
  .generator-actions .button { width: 100%; }
  .selected-exercise-actions, .library-card-actions, .exercise-card-actions { display: grid; grid-template-columns: 1fr; }
  .item { align-items: stretch; flex-direction: column; }
  .item-actions { width: 100%; flex-wrap: wrap; }
  .item-actions button { flex: 1; }
  .feedback-button { right: 14px; bottom: 90px; }
  .consent-actions, .account-actions { grid-template-columns: 1fr; }
  .auth-switch { flex-direction: column; gap: 3px; text-align: center; }
  .bottom-nav { height: 69px; bottom: max(7px, var(--app-safe-bottom)); border-radius: 20px; }
  .bottom-nav button { font-size: 9px; }
}
