:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #141414;
  --text: #fafafa;
  --muted: #737373;
  --line: #222;
  --accent: #fafafa;
  --danger: #f87171;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
.page {
  max-width: 520px;
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) 24px 64px;
}
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 40px; }
h1 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.03em; }
h2 { margin: 56px 0 8px; font-size: 13px; font-weight: 400; color: var(--muted); }
button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: opacity .15s;
}
button:hover { opacity: .6; }
button:focus-visible, input:focus-visible { outline: 1px solid var(--text); outline-offset: 2px; }
button.primary { color: var(--muted); }
button.danger { color: var(--danger); margin-right: auto; }
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.info { min-width: 0; flex: 1; text-align: left; }
.info strong, .list strong { display: block; font-size: 20px; font-weight: 400; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.muted, .info small, .list small { color: var(--muted); font-size: 14px; }
.list + .muted { margin: 0; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.field input {
  width: 50%;
  min-height: 32px;
  padding: 0;
  font: inherit;
  color: var(--text);
  text-align: right;
  background: none;
  border: 0;
}
.field input[type=range] { accent-color: var(--text); }
dialog {
  width: min(440px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: rgb(0 0 0 / 70%); backdrop-filter: blur(8px); }
dialog h2 { margin: 0 0 12px; }
dialog button.primary { color: var(--text); font-weight: 500; }
.actions { display: flex; justify-content: flex-end; gap: 24px; margin-top: 20px; }
#run {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}

/* Celular */
html { -webkit-text-size-adjust: 100%; }
button { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#run { height: 100dvh; overscroll-behavior: none; }
@media (max-width: 600px) {
  .page { padding: max(24px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom)); }
  header { margin-bottom: 20px; }
  h1 { font-size: 28px; }
  .field { min-height: 56px; }
  dialog {
    width: 100%;
    max-width: none;
    max-height: 90dvh;
    margin: auto 0 0;
    padding: 24px 20px max(20px, env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 20px 20px 0 0;
  }
  .actions button { min-height: 48px; }
}

/* Tela do timer */
#run[hidden] { display: none; }
#run p { margin: 0; }
.dial {
  --size: min(84vw, 62dvh, 420px);
  --stroke: calc(var(--size) * .055);
  position: relative;
  width: var(--size);
  height: var(--size);
}
.ring, .tip { position: absolute; inset: 0; border-radius: 50%; }
.ring {
  background: conic-gradient(
    color-mix(in srgb, var(--phase) 18%, #2b2b2b) 0turn,
    var(--phase) calc(var(--progress, 0) * 1turn),
    #2b2b2b 0
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--stroke) - .5px), #000 calc(100% - var(--stroke)));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--stroke) - .5px), #000 calc(100% - var(--stroke)));
}
.tip { transform: rotate(calc(var(--progress, 0) * 1turn)); }
.tip::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--stroke);
  height: var(--stroke);
  margin-left: calc(var(--stroke) / -2);
  border-radius: 50%;
  background: var(--phase);
  box-shadow: 0 0 calc(var(--stroke) * 1.4) var(--phase);
}
.center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#emoji { font-size: calc(var(--size) * .1); line-height: 1.3; }
#clock {
  font-size: calc(var(--size) * .23);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
#phase { color: var(--muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
#pause .play, #pause.paused .bars { display: none; }
#pause.paused .play { display: block; }
#progress { margin-top: 28px !important; color: var(--muted); font-size: 14px; }
.controls { display: flex; align-items: center; gap: 16px; margin-top: 28px; }
#stop {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid #333;
  border-radius: 50%;
}
#stop svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-height: 480px) and (orientation: landscape) {
  #run { flex-direction: row; gap: 32px; }
  .dial { --size: 84dvh; }
  #progress { display: none; }
  .controls { margin: 0; flex-direction: column; }
}

/* Home */
#home header { margin-bottom: 28px; }
#home h1 { font-size: 30px; font-weight: 600; }
#new {
  height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  background: #2b2b2b;
  color: var(--text);
  font-weight: 500;
}
#workouts { display: grid; gap: 12px; }
#workouts li {
  padding: 16px 16px 16px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #000;
}
#workouts .info strong { font-size: 19px; font-weight: 500; }
#workouts .play {
  flex: none;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ff6a1f;
  box-shadow: 0 0 24px rgb(255 106 31 / 35%);
}
#workouts .play svg { width: 22px; height: 22px; margin-left: 2px; fill: #fff; }
#history li { padding: 12px 0; }
#history strong { font-size: 16px; }
#history li:last-child { border-bottom: 0; }
#empty {
  padding: 40px 20px;
  border: 1px dashed #333;
  border-radius: 24px;
  text-align: center;
}
.page h2 { margin-top: 40px; }
#settings .field { padding: 8px 20px; border: 1px solid var(--line); border-radius: 24px; background: #000; }
#settings .field input { accent-color: #ff6a1f; }
#home button:hover { opacity: .8; }
dialog button.primary { padding: 0 20px; border-radius: 22px; background: var(--text); color: var(--bg); }

#new { background: var(--text); color: var(--bg); font-weight: 600; }
#workouts .edit {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #333;
  border-radius: 50%;
  background: #1c1c1c;
}
#workouts .edit svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#workouts li { gap: 10px; }

/* Editor */
#form .field { border: 0; padding: 0 0 8px; }
#form .field input { width: 60%; min-height: 44px; padding: 0 14px; text-align: left; background: #000; border: 1px solid var(--line); border-radius: 14px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; border-bottom: 1px solid var(--line); }
.row > span { flex: none; }
.stepper { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.stepper button {
  width: 40px;
  height: 40px;
  min-height: 0;
  border-radius: 50%;
  background: #2b2b2b;
  font-size: 20px;
  touch-action: none;
}
.stepper output { min-width: 58px; text-align: center; font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  min-height: 0;
  border-radius: 14px;
  background: #3a3a3a;
  transition: background .2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.switch[aria-checked=true] { background: #ff6a1f; }
.switch[aria-checked=true]::after { transform: translateX(18px); }
#total { margin: 14px 0 0; color: var(--muted); font-size: 14px; }

/* Controles do treino */
.controls { gap: 24px; }
#pause {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--phase, #fff);
  color: #000;
  box-shadow: 0 0 28px color-mix(in srgb, var(--phase) 40%, transparent);
  transition: background .3s;
}
#pause svg { width: 34px; height: 34px; fill: currentColor; }
#skip { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: #2b2b2b; }
#skip svg { width: 22px; height: 22px; fill: currentColor; }

/* Ícones e tamanhos padronizados */
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#emoji { color: var(--phase); line-height: 1; margin-bottom: 8px; }
#emoji .icon { width: calc(var(--size) * .11); height: calc(var(--size) * .11); }
#workouts li { padding: 14px; gap: 10px; }
.tile {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #1c1c1c;
  color: #ff6a1f;
}
#workouts .edit, #workouts .play { width: 48px; height: 48px; }
#workouts .edit svg, #workouts .play svg { width: 20px; height: 20px; }
#workouts .info strong { font-size: 17px; }
#workouts .info small { font-size: 13px; }
#stop, #pause, #skip { width: 72px; height: 72px; }
#stop { background: #2b2b2b; border: 0; }
#stop svg, #pause svg, #skip svg { width: 26px; height: 26px; }
.controls { gap: 20px; }
.actions button { min-height: 44px; }
#icons { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; padding: 4px 0 12px; }
#icons button {
  aspect-ratio: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #000;
  color: var(--muted);
}
#icons .icon { width: 20px; height: 20px; }
#icons button[aria-pressed=true] { background: #ff6a1f; color: #fff; }

/* Editor em grupos */
dialog { padding: 0; overflow: hidden; }
#form { max-height: min(88dvh, 760px); overflow-y: auto; padding: 24px 20px 0; }
#editorTitle { margin: 0 0 14px; color: var(--text); font-size: 20px; font-weight: 600; }
#nameInput {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #000;
  color: var(--text);
  font: inherit;
  font-size: 17px;
}
.group { margin-top: 20px; }
.group h3 { margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 400; }
.card { padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: #000; }
.card .row:last-child { border-bottom: 0; }
#icons { padding: 0; }
#total { text-align: center; }
.actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px -20px 0;
  padding: 12px 20px max(14px, env(safe-area-inset-bottom));
  background: var(--surface);
}
.actions button { height: 52px; border-radius: 26px; }
#cancel { background: #2b2b2b; }
dialog button.primary { font-weight: 600; }
#remove { grid-column: 1 / -1; height: 40px; min-height: 0; margin: 0; }

/* Drawer no celular */
@media (max-width: 768px), (pointer: coarse) {
  dialog {
    width: 100%;
    max-width: none;
    max-height: none;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 24px 24px 0 0;
  }
  dialog[open] { animation: drawer .28s cubic-bezier(.2, .8, .2, 1); }
  dialog[open]::backdrop { animation: fade .28s; }
  #form { max-height: 90dvh; padding-top: 28px; }
  #form::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: #444;
  }
}
@keyframes drawer { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  dialog[open], dialog[open]::backdrop { animation: none; }
}

/* Treino concluído */
#done {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: var(--bg);
}
#done[hidden] { display: none; }
#story { flex: 0 1 auto; min-height: 0; max-width: 100%; max-height: calc(100dvh - 124px); border: 1px solid var(--line); border-radius: 24px; }
.done-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(100%, 400px); }
.done-actions button { height: 52px; border-radius: 26px; background: #2b2b2b; font-weight: 500; }
#share { background: var(--text); color: var(--bg); font-weight: 600; }

/* Vidro sobre gradiente */
:root { --glass: rgb(255 255 255 / 8%); --glass-strong: rgb(255 255 255 / 14%); --glass-line: rgb(255 255 255 / 14%); --muted: #b4b4bc; }
html { background: #08070f; }
body { background: transparent; }
body::before, body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 120vmax;
  height: 120vmax;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
  pointer-events: none;
}
body::before {
  top: -70vmax;
  left: -50vmax;
  background: radial-gradient(circle, rgb(255 106 31 / 60%), transparent 62%);
  animation: drift-a 26s ease-in-out infinite alternate;
}
body::after {
  right: -60vmax;
  bottom: -70vmax;
  background: radial-gradient(circle, rgb(70 60 255 / 62%), transparent 62%);
  animation: drift-b 32s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(35vw, 45vh) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-35vw, -40vh) scale(1.2); } }
body:has(#run:not([hidden])) #home, body:has(#done:not([hidden])) #home, body:has(#settings:not([hidden])) #home { visibility: hidden; }
#run, #done { background: transparent; }

#workouts li, #settings .field, .card, #nameInput, #story, #stop, #skip, #new, #workouts .edit, .tile {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 14%);
}
#new { background: var(--glass-strong); color: var(--text); }
.tile { color: var(--text); }
#icons button { background: var(--glass); }
.stepper button, #cancel, .done-actions #close { background: var(--glass-strong); }
.row, .field { border-color: var(--glass-line); }
dialog {
  background: rgb(28 26 36 / 62%);
  border-color: var(--glass-line);
  -webkit-backdrop-filter: blur(40px) saturate(170%);
  backdrop-filter: blur(40px) saturate(170%);
}
dialog::backdrop { background: rgb(0 0 0 / 35%); }
.actions { background: rgb(30 28 38 / 88%); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border-top: 1px solid var(--glass-line); }
.ring { background: conic-gradient(color-mix(in srgb, var(--phase) 30%, transparent) 0turn, var(--phase) calc(var(--progress, 0) * 1turn), rgb(255 255 255 / 14%) 0); }
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
}

/* Monocromático */
body::before { background: radial-gradient(circle, rgb(255 255 255 / 20%), transparent 62%); }
body::after { background: radial-gradient(circle, rgb(150 150 160 / 22%), transparent 62%); }
html { background: #09090a; }
#workouts .play { background: #fff; box-shadow: none; }
#workouts .play svg { margin: 0; fill: #000; stroke: #000; stroke-width: 2; stroke-linejoin: round; }
#workouts .edit { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
#workouts .edit svg { stroke-width: 1.6; stroke-linejoin: round; }
.tile { border: 0; box-shadow: none; }
#pause { background: #fff; box-shadow: none; }
#pause .play { stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.switch[aria-checked=true] { background: #fff; }
.switch[aria-checked=true]::after { background: #000; }
#icons button[aria-pressed=true] { background: #fff; color: #000; }
#settings .field input { accent-color: #fff; }
.tip::after { box-shadow: none; }

#workouts .info small { display: block; }
#settings .field + .field { margin-top: 10px; }
#total { color: var(--text); font-weight: 500; }

/* Fonte e contraste */
:root { --muted: #d1d1d6; --glass: rgb(255 255 255 / 7%); --glass-strong: rgb(255 255 255 / 16%); --glass-line: rgb(255 255 255 / 20%); }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-feature-settings: "cv11", "ss03"; letter-spacing: -0.011em; }
#home h1, #editorTitle { font-weight: 700; letter-spacing: -0.03em; }
#workouts .info strong { font-weight: 600; }
#workouts .info small { font-size: 14px; color: var(--muted); }
.page h2, .group h3 { color: var(--text); font-size: 14px; font-weight: 600; }
#clock { font-weight: 600; letter-spacing: -0.04em; }
#phase { color: var(--text); font-weight: 600; }
.field, .row > span { color: var(--text); }
#new { color: var(--text); font-weight: 600; }
dialog { background: rgb(22 22 26 / 82%); }
#remove { color: #ff8a80; }

.tip::after { box-shadow: 0 0 calc(var(--stroke) * 1.2) var(--phase); }

/* Conta */
#loginForm { padding: 14px; }
#loginForm[hidden], #accountInfo[hidden] { display: none; }
#loginForm input { width: 100%; height: 48px; margin-bottom: 8px; padding: 0 14px; border: 1px solid var(--glass-line); border-radius: 14px; background: rgb(0 0 0 / 35%); color: var(--text); font: inherit; }
.login-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.login-actions button { height: 48px; border-radius: 24px; background: var(--glass-strong); font-weight: 600; }
.login-actions [type=submit] { background: #fff; color: #000; }
#loginError { margin: 8px 0 0; color: #ff8a80; font-size: 14px; }
#loginError:empty { display: none; }
#accountInfo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
#accountInfo strong, #accountInfo small { display: block; overflow-wrap: anywhere; }
#accountInfo small { color: var(--muted); font-size: 13px; }

/* Admin */
[hidden] { display: none !important; }
#openAdmin { width: 100%; height: 48px; margin-top: 10px; border: 1px solid var(--glass-line); border-radius: 24px; background: var(--glass-strong); font-weight: 600; }
#admin { position: fixed; inset: 0; overflow-y: auto; background: #09090a; }
#admin header { margin-bottom: 8px; }
#closeAdmin, #createInvite, #copyInvite, .admin-actions button, #adminInvites button, #resetAll {
  height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  background: var(--glass-strong);
  font-weight: 600;
}
#createInvite, #copyInvite { background: #fff; color: #000; }
.invite-row { display: flex; gap: 8px; }
#inviteNote, #inviteUrl { flex: 1; min-width: 0; width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--glass-line); border-radius: 14px; background: rgb(255 255 255 / 7%); color: var(--text); font: inherit; }
#inviteLink { display: grid; gap: 8px; margin-top: 10px; }
#inviteLink p { margin: 0; }
#admin .list { margin-top: 8px; }
#admin .list li { gap: 10px; }
#admin .list strong { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.admin-actions { display: flex; flex: none; gap: 6px; }
#admin .danger, #resetAll { margin: 0; color: #ff8a80; }
#resetAll { width: 100%; }

/* Sons */
#sounds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
#sounds button { height: 44px; border: 1px solid var(--glass-line); border-radius: 22px; background: var(--glass); font-weight: 500; }
#sounds button[aria-pressed=true] { background: #fff; color: #000; font-weight: 600; }

/* Home limpa */
.head-actions { display: flex; gap: 8px; }
.round {
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  background: var(--glass);
  color: var(--text);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
#new.round { background: #fff; color: #000; border: 0; }
.round .icon { width: 20px; height: 20px; }
#settings { position: fixed; inset: 0; overflow-y: auto; }
#settings .page h2 { margin-top: 32px; }
#settings header { margin-bottom: 12px; }
#loginBox summary { padding: 8px 0; color: var(--muted); font-size: 15px; cursor: pointer; list-style: none; }
#loginBox summary::-webkit-details-marker { display: none; }
#loginBox summary::after { content: " ›"; }
#loginBox[open] summary::after { content: ""; }
#new.round { padding: 0; }
#empty { width: 100%; height: auto; color: var(--text); font-weight: 600; }

/* Tipos de treino */
.tile { color: var(--type, #fff); background: color-mix(in srgb, var(--type, #fff) 18%, transparent); }
#icons { grid-template-columns: repeat(5, 1fr); gap: 6px; }
#icons button { aspect-ratio: auto; height: 68px; gap: 4px; align-content: center; justify-items: center; color: var(--type); font-size: 11px; font-weight: 600; }
#icons button span { color: var(--text); }
#icons .icon { width: 24px; height: 24px; }
#icons button[aria-pressed=true] { background: var(--type); color: #000; }
#icons button[aria-pressed=true] span { color: #000; }

/* Foto do compartilhamento */
#done { gap: 12px; }
#story { max-height: calc(100dvh - 180px); }
.photo-actions { display: flex; gap: 8px; width: min(100%, 400px); }
#photoButton {
  flex: 1;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-line);
  border-radius: 22px;
  background: var(--glass);
  font-weight: 500;
  cursor: pointer;
}
#photo { position: absolute; width: 1px; height: 1px; opacity: 0; }
#removePhoto { height: 44px; padding: 0 16px; border-radius: 22px; background: var(--glass); color: #ff8a80; }

/* Editor focado no tempo */
#editorTitle, .group h3 { display: none; }
#nameInput { height: 40px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; font-size: 20px; font-weight: 600; }
#total { margin: 2px 0 0; text-align: left; color: var(--muted); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.group { margin-top: 14px; }
#icons { gap: 4px; }
#icons button { height: 56px; background: none; font-size: 11px; }
#icons .icon { width: 22px; height: 22px; }
#fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
#fields .group, #fields .card { display: contents; }
#fields .row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  align-content: space-between;
  gap: 10px;
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: var(--glass);
}
#fields .row > span { color: var(--muted); font-size: 13px; }
#fields .stepper { grid-column: 1 / -1; justify-content: space-between; margin: 0; }
#fields .stepper button { width: 34px; height: 34px; font-size: 18px; }
#fields .stepper output { min-width: 0; font-size: 22px; font-weight: 600; }
#fields .row[data-key=work] { grid-column: 1 / -1; order: -1; min-height: 124px; }
#fields .row[data-key=work] output { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; }
#fields .row[data-key=work] .stepper button { width: 44px; height: 44px; }
#fields .row[data-key=cycleRest] { grid-column: 1 / -1; min-height: 0; }
#fields .switch { width: 36px; height: 22px; }
#fields .switch::after { top: 3px; left: 3px; width: 16px; height: 16px; }
#fields .switch[aria-checked=true]::after { transform: translateX(14px); }

/* Imagem em largura total */
#done { justify-content: flex-start; padding: 0 0 max(14px, env(safe-area-inset-bottom)); }
#story { flex: 1 1 0; width: 100%; max-width: 520px; max-height: none; object-fit: cover; object-position: bottom; border: 0; border-radius: 0 0 24px 24px; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.photo-actions, .done-actions { width: min(100% - 32px, 400px); }

/* Desempenho: vidro real só nas camadas grandes */
#workouts li, #settings .field, .card, #nameInput, #story, #stop, #skip, #new, #workouts .edit, .tile, .round {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
body::before, body::after { filter: blur(48px); }
#workouts li { contain: layout paint; }

/* Animações leves */
button, .tile, #photoButton { transition: transform .14s ease, opacity .14s ease, background .2s; }
button:active, #photoButton:active { transform: scale(.95); }
#workouts.enter li { animation: rise .42s cubic-bezier(.2, .8, .2, 1) both; }
#workouts.enter li:nth-child(2) { animation-delay: .05s; }
#workouts.enter li:nth-child(3) { animation-delay: .1s; }
#workouts.enter li:nth-child(4) { animation-delay: .15s; }
#workouts.enter li:nth-child(n+5) { animation-delay: .2s; }
#settings:not([hidden]), #admin:not([hidden]) { animation: rise .26s cubic-bezier(.2, .8, .2, 1); }
#run:not([hidden]), #done:not([hidden]) { animation: appear .3s ease; }
#clock { transition: opacity .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes appear { from { opacity: 0; transform: scale(.98); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Ícones Tabler */
.icon { stroke-width: 1.75; }
#workouts .edit svg { stroke-width: 1.75; stroke-linejoin: round; }
#stop svg { fill: none; }
#workouts .play svg, #pause svg, #skip svg { stroke: none; fill: currentColor; }
#workouts .play svg { fill: #000; width: 22px; height: 22px; }

/* Editor em página própria */
dialog {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #09090a;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
dialog[open] { animation: page .26s cubic-bezier(.2, .8, .2, 1); }
dialog::backdrop { background: #09090a; }
@keyframes page { from { opacity: 0; transform: translateX(28px); } }
#form { position: static; height: 100%; max-height: none; max-width: 520px; margin: 0 auto; padding: 0 20px max(32px, env(safe-area-inset-bottom)); }
#form::before { display: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 0 -20px;
  padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  background: rgb(9 9 10 / 92%);
}
#editorTitle { display: block; margin: 0; text-align: center; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.topbar .primary { height: 44px; min-height: 0; padding: 0 18px; border-radius: 22px; background: #fff; color: #000; font-weight: 600; }
#nameInput { height: 52px; margin-top: 8px; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
#total { margin: 0; }
.group h3 { display: block; margin: 0 0 8px; color: var(--text); font-size: 14px; font-weight: 600; }
.group { margin-top: 24px; }
#fields { display: block; margin: 0; }
#fields .group { display: block; }
#fields .card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
#fields .row { border: 1px solid var(--glass-line); }
#fields .row[data-key=cycleRest], #fields .row[data-key=cooldown] { grid-column: 1 / -1; }
#fields .row.off { min-height: 0; }
#fields .row.off > span { color: var(--muted); }
.actions { position: static; display: block; margin: 24px 0 0; padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
#remove { width: 100%; height: 48px; }
@media (max-width: 768px), (pointer: coarse) {
  dialog { width: 100%; margin: 0; border-width: 0; border-radius: 0; }
  dialog[open] { animation: page .26s cubic-bezier(.2, .8, .2, 1); }
  #form { max-height: none; padding-top: 0; }
}

/* Campos em linhas */
.topbar { background: #09090a; }
#fields .group { margin-top: 12px; }
#fields .group h3 { display: none; }
#fields .card { display: block; }
#fields .row, #fields .row[data-key], #fields .row.off {
  display: grid;
  grid-template-columns: 1fr auto 40px;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  height: auto;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--glass-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}
#fields .row > span { grid-column: 1; color: var(--text); font-size: 15px; font-weight: 400; }
#fields .row.off > span { color: var(--muted); }
#fields .row .stepper, #fields .row[data-key=work] .stepper { grid-column: 2; grid-row: 1; gap: 2px; margin: 0; }
#fields .row .switch { grid-column: 3; grid-row: 1; justify-self: end; }
#fields .row .stepper button, #fields .row[data-key=work] .stepper button { width: 32px; height: 32px; background: none; color: var(--muted); font-size: 18px; }
#fields .row .stepper output, #fields .row[data-key=work] .stepper output { min-width: 56px; font-size: 16px; font-weight: 600; }
#fields .row, #fields .row[data-key], #fields .row.off { grid-template-rows: 56px; grid-auto-rows: 0; min-height: 0; row-gap: 0; }
#fields { margin-top: 12px; }

/* Histórico */
#stats { position: fixed; inset: 0; overflow-y: auto; background: #09090a; }
#stats:not([hidden]) { animation: rise .26s cubic-bezier(.2, .8, .2, 1); }
body:has(#stats:not([hidden])) #home { visibility: hidden; }
#stats section { margin-top: 28px; }
#stats h2 { margin: 0 0 12px; color: var(--text); font-size: 14px; font-weight: 600; }
#periods { display: flex; gap: 4px; margin-top: 4px; }
#periods button { height: 36px; min-height: 0; padding: 0 14px; border: 0; border-radius: 18px; background: none; color: var(--muted); font-size: 14px; font-weight: 500; }
#periods button[aria-pressed=true] { background: #fff; color: #000; }
#statTiles { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 12px; margin-top: 20px; }
#statTiles strong { display: block; font-size: 32px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
#statTiles span { color: var(--muted); font-size: 13px; }
#weekBars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 120px; }
#weekBars div { display: grid; grid-template-rows: 1fr 20px; justify-items: center; align-items: end; min-height: 0; position: relative; }
#weekBars i { display: block; width: 100%; max-width: 28px; align-self: end; border-radius: 6px 6px 2px 2px; background: #fff; }
#weekBars div { --h: 100px; }
#weekBars span { color: var(--muted); font-size: 12px; text-transform: uppercase; }
/* Editor rola na página inteira, na largura das outras telas */
dialog[open] { display: block; overflow-y: auto; scrollbar-width: none; }
dialog::-webkit-scrollbar { display: none; }
#form { height: auto; min-height: 100%; overflow: visible; max-width: 520px; scrollbar-width: none; }

/* Minimalismo geral: fundo liso, sem cartões, mais espaço */
body { background: #09090a; }
body::before, body::after { display: none; }
.page { padding-top: max(56px, env(safe-area-inset-top)); }
.page header { margin-bottom: 32px; }
.round, #new.round {
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--text);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.head-actions { gap: 4px; }
#workouts { display: block; }
#workouts li {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--glass-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
#workouts .tile { width: 24px; height: 24px; flex: none; border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
#workouts .tile .icon { width: 24px; height: 24px; }
#workouts .info { flex: 1; min-width: 0; }
#workouts .info strong { font-size: 17px; font-weight: 600; }
#workouts .edit { display: none; }
#workouts .play { width: 44px; height: 44px; flex: none; border: 0; background: none; box-shadow: none; }
#workouts .play svg { width: 22px; height: 22px; margin: 0; fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; }
#settings .field, .card {
  border: 0;
  border-bottom: 1px solid var(--glass-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
#stop, #skip { border: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Fundo: a linha do logo pulsando */
#pulseBg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#pulseBg svg { width: 100%; height: 100%; fill: none; stroke: #ff6a1f; stroke-linecap: round; stroke-linejoin: round; }
#pulseBg path { stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#pulseBg .base { opacity: .07; }
#pulseBg .beat { opacity: .4; stroke-dasharray: 14 86; stroke-dashoffset: 14; animation: beat 5s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes beat { to { stroke-dashoffset: -100; } }
body:has(#run:not([hidden])) #pulseBg, body:has(#done:not([hidden])) #pulseBg { display: none; }
@media (prefers-reduced-motion: reduce) { #pulseBg .beat { display: none; } }
/* Novo treino em destaque */
#new.round { width: 44px; height: 44px; margin-left: 6px; background: #ff6a1f; color: #000; }
#new.round .icon { stroke-width: 2.25; }

/* Treinos em cards */
#workouts { display: grid; gap: 12px; }
#workouts li {
  gap: 16px;
  padding: 24px 20px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 20px;
  background: #131315;
}
#workouts li:last-child { border-bottom: 1px solid rgb(255 255 255 / 8%); }

/* Editor em cards */
#fields .card {
  display: block;
  padding: 4px 20px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 20px;
  background: #131315;
}
#fields .row:last-child { border-bottom: 0; }
#icons button { background: #131315; border-radius: 16px; }
#fields .row, #fields .row[data-key], #fields .row.off { grid-template-columns: 1fr auto 40px; grid-template-rows: 60px; }

/* Esportes em faixa rolável */
#icons { display: flex; gap: 8px; margin: 0 -20px; padding: 0 20px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
#icons::-webkit-scrollbar { display: none; }
#icons button { flex: 0 0 76px; scroll-snap-align: center; }

/* Divisórias mais sutis */
#fields .row, #fields .row[data-key], #fields .row.off { border-bottom-color: rgb(255 255 255 / 5%); }
#fields .row:last-child { border-bottom: 0; }

#total { margin-top: 12px; text-align: center; }

/* Fundo animado mais presente */
#pulseBg path { stroke-width: 2; }
#pulseBg .base { opacity: .16; }
#pulseBg .beat { opacity: .85; stroke-dasharray: 22 78; stroke-dashoffset: 22; animation-duration: 3.6s; filter: drop-shadow(0 0 6px #ff6a1f); }
#workouts li { background: rgb(19 19 21 / 72%); }

/* Dificuldade ao fim do treino */
#effortBox { width: 100%; max-width: 420px; margin: 0 auto; }
#effortBox p { margin: 0 0 8px; color: var(--text); font-size: 14px; font-weight: 600; text-align: center; }
#effort { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#effort button { height: 40px; min-height: 0; padding: 0; border: 1px solid rgb(255 255 255 / 8%); border-radius: 14px; background: #131315; color: var(--text); font-size: 13px; font-weight: 500; }
#effort button[aria-pressed=true] { border-color: #ff6a1f; background: #ff6a1f; color: #000; }
#effortShow { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 13px; }

/* Ajustes no padrão de cards */
#settings .field {
  min-height: 60px;
  margin: 0 0 10px;
  padding: 0 20px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 20px;
  background: #131315;
}
#sounds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 10px; }
#sounds button { height: 48px; min-height: 0; padding: 0; border: 1px solid rgb(255 255 255 / 8%); border-radius: 16px; background: #131315; color: var(--text); font-size: 14px; font-weight: 500; }
#sounds button[aria-pressed=true], #sounds button[aria-checked=true] { border-color: #fff; background: #fff; color: #000; opacity: 1; }
#loginBox, #accountInfo.card { padding: 18px 20px; border: 1px solid rgb(255 255 255 / 8%); border-radius: 20px; background: #131315; }
#openAdmin { width: 100%; margin-top: 10px; }
/* Fim do treino com margem lateral */
#effortBox { box-sizing: border-box; padding: 0 16px; }

/* Estilos do story */
#storyStyles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; box-sizing: border-box; width: 100%; max-width: 420px; margin: 0 auto; padding: 0 16px; }
#storyStyles button { height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 13px; font-weight: 500; }
#storyStyles button[aria-pressed=true] { background: #fff; color: #000; }

/* Histórico no padrão de cards */
#stats { background: none; }
#periods { padding: 4px; border: 1px solid rgb(255 255 255 / 8%); border-radius: 16px; background: rgb(19 19 21 / 72%); }
#periods button { flex: 1; border-radius: 12px; }
#statTiles { gap: 10px; margin-top: 12px; }
#statTiles > div { padding: 20px; border: 1px solid rgb(255 255 255 / 8%); border-radius: 20px; background: rgb(19 19 21 / 72%); }
#statTiles strong { font-size: 28px; }
#weekBars { height: 168px; padding: 20px; border: 1px solid rgb(255 255 255 / 8%); border-radius: 20px; background: rgb(19 19 21 / 72%); box-sizing: border-box; }
#weekBars i { background: #ff6a1f; }
#history { display: grid; gap: 10px; }
#history li, #history li:last-child { padding: 18px 20px; border: 1px solid rgb(255 255 255 / 8%); border-radius: 20px; background: rgb(19 19 21 / 72%); }
/* Prévia do story inteira */
#story { object-fit: contain; }

#video { box-sizing: border-box; width: calc(100% - 32px); max-width: 388px; height: 48px; min-height: 0; margin: 0 auto; border: 1px solid #ff6a1f; border-radius: 24px; background: none; color: #ff6a1f; font-weight: 600; }

/* Cores do story */
#storyColors { display: flex; justify-content: center; gap: 12px; }
#storyColors button { width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: var(--swatch); }
#storyColors button[aria-pressed=true] { outline: 2px solid #fff; outline-offset: 2px; }
#story { background: none; }

#effort button { display: grid; justify-items: center; align-content: center; gap: 4px; height: 60px; font-size: 12px; }
#effort .icon { width: 20px; height: 20px; }

/* Tela final: prévia grande e um controle por vez */
#done { display: flex; flex-direction: column; gap: 16px; box-sizing: border-box; height: 100dvh; padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom)); overflow: hidden; }
#done > #story { flex: 1; min-height: 0; width: 100%; max-width: none; height: auto; margin: 0; border: 0; box-shadow: none; }
#doneTabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 100%; max-width: 480px; margin: 0 auto; }
#doneTabs button { height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 14px; font-weight: 500; }
#doneTabs button[aria-pressed=true] { background: #1d1d20; color: var(--text); }
#donePanel { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 480px; height: 136px; margin: 0 auto; }
#donePanel > div { width: 100%; }
#donePanel > div[hidden] { display: none; }
#donePanel #storyStyles, #donePanel #effortBox { max-width: none; padding: 0; }
#donePanel .photo-actions { margin: 0; }
#donePanel #video { display: block; width: 100%; max-width: none; margin-top: 10px; }
#donePanel #video[hidden] { display: none; }
#effortBox p { margin-bottom: 10px; }
#effort button { height: 56px; }
.done-actions { width: 100%; max-width: 480px; margin: 0 auto; }

/* Abas visíveis e miniaturas dos visuais */
#doneTabs { gap: 8px; }
#doneTabs button { display: grid; justify-items: center; align-content: center; gap: 3px; height: 58px; border: 1px solid rgb(255 255 255 / 8%); border-radius: 16px; background: #131315; color: var(--text); font-size: 12px; }
#doneTabs .icon { width: 20px; height: 20px; }
#doneTabs button[aria-pressed=true] { border-color: #fff; background: #fff; color: #000; }
#donePanel { height: 150px; }
#donePanel #storyStyles { display: flex; gap: 10px; margin: 0 -20px; padding: 3px 20px; width: auto; overflow-x: auto; scrollbar-width: none; }
#storyStyles::-webkit-scrollbar { display: none; }
#storyStyles button { display: grid; flex: 0 0 66px; justify-items: center; gap: 4px; height: auto; background: none; color: var(--muted); font-size: 11px; }
#storyStyles button[aria-pressed=true] { background: none; color: var(--text); }
#storyStyles canvas { width: 66px; height: 117px; border-radius: 10px; }
#storyStyles button[aria-pressed=true] canvas { outline: 2px solid #fff; outline-offset: 1px; }

/* Visuais: deslizar a prévia */
#doneTabs { grid-template-columns: repeat(3, 1fr); }
#done > #story { display: none; }
#done #storyStyles { display: flex; flex: 1; align-items: center; gap: 12px; box-sizing: border-box; min-height: 0; width: auto; max-width: none; margin: 0 -20px; padding: 0 calc(50vw - 28dvh / 1.3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
#done #storyStyles canvas { flex: none; width: auto; height: 100%; aspect-ratio: 9 / 16; border-radius: 16px; scroll-snap-align: center; }
#styleName { margin: -6px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
#done #storyStyles { position: relative; align-items: stretch; padding-block: 0; }
#done #storyStyles canvas { height: 100%; min-height: 0; }
#donePanel .photo-actions { display: flex; justify-content: center; width: 100%; max-width: none; }
#donePanel #photoButton { flex: 1; box-sizing: border-box; width: 100%; max-width: none; text-align: center; }
#done #storyStyles { flex: 1 1 0; width: 100vw; max-width: 100vw; min-width: 0; margin: 0 -20px; align-self: center; }

/* Um visual por vez, com setas */
#styleStage { position: relative; flex: 1 1 0; min-height: 0; width: 100%; max-width: 480px; margin: 0 auto; }
#done #storyStyles { position: absolute; inset: 0; display: flex; gap: 0; width: 100%; max-width: none; height: 100%; margin: 0; padding: 0; }
#done #storyStyles canvas { flex: 0 0 100%; width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; border-radius: 0; scroll-snap-align: center; scroll-snap-stop: always; }
.arrow { position: absolute; top: 50%; display: grid; place-items: center; width: 40px; height: 40px; min-height: 0; padding: 0; border: 1px solid rgb(255 255 255 / 14%); border-radius: 50%; background: rgb(19 19 21 / 80%); color: #fff; transform: translateY(-50%); }
#stylePrev { left: 0; }
#styleNext { right: 0; }
.arrow .icon { width: 20px; height: 20px; }

/* Cor em menu compacto */
#doneTabs { grid-template-columns: repeat(2, 1fr); }
#colorToggle { position: absolute; top: 8px; right: 0; z-index: 2; width: 36px; height: 36px; min-height: 0; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--swatch); }
#storyColors { position: absolute; top: 52px; right: 0; z-index: 2; display: grid; gap: 10px; padding: 10px; border: 1px solid rgb(255 255 255 / 12%); border-radius: 22px; background: #131315; }
#storyColors[hidden] { display: none; }

/* Tela final no estilo iOS: prévia, barra simples e folhas */
#done { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
#close.round { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 16px; z-index: 3; }
#colorToggle { top: 0; width: 30px; height: 30px; border-width: 1.5px; }
#storyColors { top: 40px; }
.arrow { width: 34px; height: 34px; border: 0; background: rgb(255 255 255 / 10%); }
#doneBar { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 480px; margin: 0 auto; }
#doneBar #doneTabs { display: flex; flex: none; gap: 10px; width: auto; margin: 0; }
#doneBar #doneTabs button { width: 50px; height: 50px; padding: 0; border: 0; border-radius: 50%; background: #1c1c1f; color: #fff; }
#doneBar #doneTabs button span { display: none; }
#doneBar #doneTabs button[aria-pressed=true] { background: #1c1c1f; color: #fff; }
#doneBar #share { flex: 1; height: 50px; min-height: 0; border: 0; border-radius: 25px; background: #fff; color: #000; font-weight: 600; }
#sheetShade { position: fixed; inset: 0; z-index: 4; background: rgb(0 0 0 / 50%); }
#donePanel { position: fixed; inset: auto 0 0; z-index: 5; display: block; box-sizing: border-box; width: 100%; max-width: 520px; height: auto; margin: 0 auto; padding: 28px 20px max(24px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: #1c1c1f; transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
#donePanel.open { transform: none; }
#donePanel::before { content: ""; position: absolute; top: 8px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: rgb(255 255 255 / 24%); }
#donePanel #effortBox p { margin-bottom: 16px; font-size: 17px; }
#donePanel #effort { grid-template-columns: repeat(2, 1fr); gap: 8px; }
#donePanel #effort button { height: 64px; background: #2a2a2e; border: 0; font-size: 14px; }
#donePanel #effort button[aria-pressed=true] { background: #fff; color: #000; }
#donePanel #effortShow { margin-top: 16px; font-size: 15px; color: var(--text); }

/* Cor na barra e Cancelar na folha */
#doneBar #doneTabs #colorToggle { position: static; width: 50px; height: 50px; border: 7px solid #1c1c1f; outline: 0; background: var(--swatch); }
.sheet-title { margin: 0 0 16px; color: var(--text); font-size: 17px; font-weight: 600; text-align: center; }
#donePanel #storyColors { position: static; display: flex; justify-content: space-between; gap: 8px; padding: 0; border: 0; border-radius: 0; background: none; }
#donePanel #storyColors button { width: 38px; height: 38px; }
#sheetCancel { display: block; width: 100%; height: 50px; min-height: 0; margin-top: 16px; border: 0; border-radius: 16px; background: #2a2a2e; color: var(--text); font-size: 16px; font-weight: 600; }

/* Configurações no topo, ações embaixo */
#done { padding-top: max(72px, calc(env(safe-area-inset-top) + 60px)); }
#doneBar #doneTabs { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 0; right: 0; justify-content: center; gap: 12px; }
#doneBar #close { flex: 1; height: 50px; min-height: 0; padding: 0; border: 0; border-radius: 25px; background: #1c1c1f; color: var(--text); font-weight: 600; }
#doneBar #share { padding: 0; }

/* Opções centradas e X para sair */
#done { position: fixed; inset: 0; }
#doneBar { position: static; }
#doneBar #doneTabs { left: 50%; right: auto; width: max-content; max-width: none; transform: translateX(-50%); }
#doneBar #close { position: absolute; top: max(12px, env(safe-area-inset-top)); left: max(20px, calc(50% - 240px)); flex: none; width: 50px; height: 50px; background: none; }
#doneBar #close .icon { width: 24px; height: 24px; }
#doneBar #saveStory { flex: 1; height: 50px; min-height: 0; padding: 0; border: 0; border-radius: 25px; background: #1c1c1f; color: var(--text); font-weight: 600; }
