:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --section-bg: var(--tg-theme-section-bg-color, var(--tg-theme-secondary-bg-color, #f2f3f5));
  --text: var(--tg-theme-text-color, #191919);
  --hint: var(--tg-theme-hint-color, #8a8a8a);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --separator: var(--tg-theme-section-separator-color, rgba(127, 127, 127, 0.2));
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--tg-theme-secondary-bg-color, var(--bg));
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 640px; margin: 0 auto; padding: 16px 12px calc(24px + env(safe-area-inset-bottom)); }
h1 { font-size: 22px; margin: 4px 4px 6px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--hint); font-weight: 600; margin: 0; }
.hint { color: var(--hint); font-size: 13px; margin: 0 4px 12px; }
.center { text-align: center; }
.muted { color: var(--hint); font-weight: 400; }
section { margin-top: 18px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 8px; }
.list { background: var(--section-bg); border-radius: 12px; overflow: hidden; }
.list:empty { display: none; }
.skill { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--separator); }
.skill:last-child { border-bottom: none; }
.skill.off .skill-main { opacity: 0.55; }
.skill-main { flex: 1; min-width: 0; }
.skill-title { display: flex; align-items: center; gap: 8px; }
.name { font: 600 15px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.badge { font-size: 11px; color: var(--hint); border: 1px solid var(--separator); border-radius: 6px; padding: 0 5px; }
.badge:empty { display: none; }
.description { margin: 4px 0 2px; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.skill.open .description { -webkit-line-clamp: unset; }
.meta { margin: 0; font-size: 12px; }
.row-actions { display: flex; gap: 16px; margin-top: 6px; }
.link { background: none; border: none; padding: 0; color: var(--link); font: inherit; font-size: 14px; cursor: pointer; }
.link.danger { color: var(--danger); }
.link[hidden] { display: none; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.button {
  flex: 1; min-width: 150px; text-align: center; padding: 11px 12px; border-radius: 10px; border: none;
  background: var(--section-bg); color: var(--link); font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.button.primary { background: var(--button); color: var(--button-text); }
.button.busy { opacity: 0.6; pointer-events: none; }
.switch { position: relative; flex: none; width: 46px; height: 28px; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--separator); border-radius: 14px; transition: background 0.15s; cursor: pointer; }
.switch span::before {
  content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s;
}
.switch input:checked + span { background: var(--button); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { opacity: 0.5; }

.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end;
  justify-content: center; z-index: 10;
}
.overlay[hidden] { display: none; }
.sheet {
  background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-title { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 6px; overflow-wrap: anywhere; }
.sheet h3 { font-size: 13px; color: var(--hint); text-transform: uppercase; letter-spacing: 0.04em; margin: 14px 0 6px; }
.sheet p { margin: 6px 0; }
.sheet p:empty { display: none; }
.warning {
  background: color-mix(in srgb, var(--danger) 12%, transparent); border-radius: 10px; padding: 10px 12px; font-size: 14px;
}
#review-instructions {
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--section-bg); border-radius: 10px; padding: 10px 12px;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 40vh; overflow-y: auto; margin: 0;
}
