:root {
  --paper: #f2ebdd;
  --paper-2: #e8dfcd;
  --card: #fbf8f1;
  --mat: #f7f2e7;
  --ink: #1f1a16;
  --ink-2: #4a4138;
  --muted: #857a6c;
  --line: rgba(31, 26, 22, 0.14);
  --line-strong: rgba(31, 26, 22, 0.32);
  --terra: #b8492f;
  --terra-dark: #8e3420;
  --battle: #b5533a;
  --ochre: #c9912f;
  --ultra: #2b3d8f;
  --sage: #5f7f5a;
  --wall: #232c28;
  --wall-2: #2d3833;
  --on-wall: #efe7d6;
  --on-wall-muted: rgba(239, 231, 214, 0.62);
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --brush: 'Kaushan Script', cursive;
  --body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --topbar: 64px;
  --shadow-sheet: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 1px 2px rgba(60, 40, 20, 0.08), 0 12px 32px -18px rgba(60, 40, 20, 0.35);
  --walnut: linear-gradient(135deg, #3a2a1f, #5d4431 38%, #2e2119 58%, #4b3626 82%, #33251b);
  --gilt: linear-gradient(135deg, #7d5d24, #d9b96a 28%, #8a6a2e 52%, #cfae62 76%, #6f5120);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.38;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .2 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body[data-screen='salon']::after, body[data-screen='verdict']::after { mix-blend-mode: overlay; opacity: 0.5; }

.defs { position: absolute; width: 0; height: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: inherit; }
img { max-width: 100%; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; letter-spacing: -0.01em; }
.display { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.05; font-variation-settings: 'opsz' 96, 'SOFT' 60; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--terra);
}
.hint { color: var(--muted); font-size: 13.5px; margin: 10px 0 0; }

/* ---------- Botões ---------- */

.btn {
  --bg: transparent;
  --fg: var(--ink);
  --bd: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border: 1.5px solid var(--bd);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.btn:hover:not(:disabled) { --bg: var(--ink); --fg: var(--paper); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible, .tool-btn:focus-visible, .swatch:focus-visible, .icon-btn:focus-visible, .segmented button:focus-visible, .frame:focus-visible {
  outline: 2px solid var(--ultra);
  outline-offset: 3px;
}
.btn.primary { --bg: var(--ink); --fg: var(--paper); }
.btn.primary:hover:not(:disabled) { --bg: var(--terra); --bd: var(--terra); }
.btn.ghost { --bd: var(--line-strong); }
.btn.small { padding: 8px 16px; font-size: 13px; }
.btn.big { padding: 17px 30px; font-size: 15px; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: #fff; border-color: var(--line-strong); }
.icon-btn svg, .tool-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-sheet);
}

/* ---------- Barra superior ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(242, 235, 221, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
body[data-screen='salon'] .topbar, body[data-screen='verdict'] .topbar {
  background: rgba(30, 38, 34, 0.88);
  color: var(--on-wall);
  border-color: rgba(255, 255, 255, 0.08);
}
body[data-screen='salon'] .topbar .btn, body[data-screen='verdict'] .topbar .btn { --fg: var(--on-wall); --bd: rgba(255, 255, 255, 0.28); }
.brand {
  font-family: var(--display);
  font-size: 26px;
  font-style: italic;
  font-variation-settings: 'opsz' 72, 'SOFT' 100;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand span, .wordmark span { color: var(--terra); }
.topbar-mid { display: flex; align-items: center; gap: 18px; visibility: hidden; }
.topbar-mid.on { visibility: visible; }
.round-label { font-family: var(--display); font-size: 17px; white-space: nowrap; }
.round-label b { font-weight: 600; }
.round-label i { color: var(--muted); }
body[data-screen='salon'] .round-label i, body[data-screen='verdict'] .round-label i { color: var(--on-wall-muted); }
.topbar-end { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.room-chip { font-size: 13px; color: var(--muted); }
.room-chip b { font-family: var(--display); font-size: 16px; letter-spacing: 0.12em; color: currentColor; margin-left: 4px; }
body[data-screen='salon'] .room-chip, body[data-screen='verdict'] .room-chip { color: var(--on-wall-muted); }

.timer { display: flex; align-items: center; gap: 8px; font: 600 16px/1 var(--body); font-variant-numeric: tabular-nums; }
.timer svg { width: 30px; height: 30px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 3; }
.timer .track { stroke: currentColor; opacity: 0.18; }
.timer .bar { stroke: currentColor; stroke-dasharray: 100; stroke-linecap: round; transition: stroke 0.3s; }
.timer.urgent { color: var(--terra); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

/* ---------- Telas ---------- */

.screen { display: none; }
.screen.active { display: block; animation: enter 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Entrada ---------- */

.home { position: relative; min-height: 100dvh; overflow: hidden; }
.home-art { position: absolute; inset: 0; pointer-events: none; }
.blob {
  position: absolute;
  width: var(--s, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 42%, var(--c) 0%, var(--c) 30%, transparent 68%);
  filter: url(#wc);
  opacity: 0.5;
  animation: drift 26s ease-in-out infinite alternate;
}
.b1 { --c: #2b3d8f; --s: 520px; top: -120px; right: -60px; }
.b2 { --c: #c9912f; --s: 380px; top: 180px; right: 240px; animation-delay: -6s; opacity: 0.45; }
.b3 { --c: #b8492f; --s: 300px; top: 360px; right: -40px; animation-delay: -12s; }
.b4 { --c: #5f7f5a; --s: 260px; bottom: -80px; left: -60px; animation-delay: -3s; opacity: 0.35; }
.b5 { --c: #b03068; --s: 200px; top: 70px; right: 420px; animation-delay: -18s; opacity: 0.3; }
@keyframes drift {
  to { transform: translate(-30px, 24px) rotate(18deg) scale(1.06); }
}

.home-inner { position: relative; max-width: 1120px; margin: 0 auto; padding: clamp(48px, 9vh, 110px) 24px 64px; }
.wordmark {
  font-size: clamp(84px, 15vw, 196px);
  line-height: 0.86;
  font-style: italic;
  font-weight: 350;
  letter-spacing: -0.045em;
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
  margin: 0 0 22px -0.04em;
}
.wordmark.small { font-size: clamp(64px, 10vw, 128px); }
.home-inner .wordmark { position: relative; width: fit-content; margin-bottom: 0.36em; }
/* "Battle" pincelado em vermelho, centralizado sobre a base do "Atelier". */
.wordmark-sub {
  position: absolute;
  left: 87%;
  bottom: -0.44em;
  transform: translateX(-50%) rotate(-6deg);
  font-family: var(--brush);
  font-size: 0.27em;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  color: var(--battle);
  pointer-events: none;
}
.brand small { font-family: var(--brush); font-style: normal; font-size: 0.8em; letter-spacing: 0; color: var(--battle); }
.lede { max-width: 520px; font-size: 18px; line-height: 1.55; color: var(--ink-2); margin: 0 0 40px; }

.entry { max-width: 560px; padding: 26px 26px 24px; }
.field { display: block; }
.field span { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.field input {
  width: 100%;
  border: 0;
  border-bottom: 1.5px solid var(--line-strong);
  background: transparent;
  padding: 6px 0 10px;
  font: italic 400 30px/1.2 var(--display);
  font-variation-settings: 'opsz' 72, 'SOFT' 100;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus { border-color: var(--terra); }
.field input::placeholder { color: rgba(31, 26, 22, 0.28); }
.entry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: 22px; }
.or { font-size: 13px; color: var(--muted); font-style: italic; font-family: var(--display); }
.join { display: flex; gap: 8px; }
.join input {
  width: 118px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  padding: 0 16px;
  font: 600 15px/1 var(--body);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  outline: none;
}
.join input:focus { border-color: var(--ink); }

.steps { list-style: none; padding: 0; margin: 72px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.steps li { border-top: 1px solid var(--line-strong); padding-top: 18px; }
.numeral { font: italic 400 34px/1 var(--display); color: var(--terra); font-variation-settings: 'opsz' 96; }
.steps h3 { font-size: 24px; margin: 10px 0 6px; }
.steps p { margin: 0; color: var(--ink-2); font-size: 14.5px; }

/* ---------- Sala de espera ---------- */

.lobby-grid {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 28px;
  align-items: start;
}
.room-card, .settings-card { padding: 30px; }
.room-code {
  display: inline-block;
  font: 500 clamp(56px, 7vw, 84px)/1 var(--display);
  letter-spacing: 0.14em;
  padding: 14px 10px 14px 24px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  color: var(--terra);
  transform: rotate(-1.5deg);
  margin: 4px 0 18px;
  background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(184, 73, 47, 0.04) 6px 7px);
}
.room-card .btn { display: flex; width: max-content; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 6px; }
.section-head h2 { font-size: 24px; }
.count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.artists, .status-list, #scoreboard, .standings { list-style: none; margin: 0; padding: 0; }
.artists li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); animation: enter 0.4s both; }
.artists li.offline, .status-list li.offline { opacity: 0.45; }
.artist-name { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artist-name em { font-style: normal; color: var(--muted); font-weight: 400; }
.badge { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--paper); }
.badge.soft { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }

.avatar {
  --size: 38px;
  flex: none;
  width: var(--size);
  height: var(--size);
  display: grid;
  place-items: center;
  border-radius: 58% 42% 52% 48% / 46% 56% 44% 54%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.32), transparent 50%), var(--c);
  color: #fff;
  font: italic 500 calc(var(--size) * 0.46) / 1 var(--display);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.18);
}
.avatar.small { --size: 28px; }
.avatar.large { --size: 76px; }

.setting { margin-top: 26px; }
.setting-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented button {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.segmented button:hover:not(:disabled) { border-color: var(--ink); }
.segmented button.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.segmented button:disabled { cursor: default; }
.segmented button:disabled:not(.on) { opacity: 0.55; }
.start-row { margin-top: 36px; padding-top: 26px; border-top: 1px solid var(--line); }

/* ---------- Ateliê ---------- */

.studio { position: relative; }
.studio-grid {
  --dock: 150px;
  height: calc(100dvh - var(--topbar));
  display: grid;
  grid-template-columns: 76px minmax(220px, 0.72fr) minmax(0, 1.6fr);
  gap: 20px;
  padding: 18px 22px 18px 16px;
}

.tools { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; scrollbar-width: none; }
.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tool-btn span { font-size: 10.5px; font-weight: 500; line-height: 1.1; }
.tool-btn svg { width: 22px; height: 22px; }
.tool-btn:hover { background: rgba(255, 255, 255, 0.55); color: var(--ink); }
.tool-btn.on { background: var(--card); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-sheet); }
.tool-btn.on svg { stroke: var(--terra); }
.tools-sep { height: 1px; background: var(--line); margin: 6px 10px; flex: none; }

.ref-col { display: flex; flex-direction: column; gap: 20px; min-height: 0; overflow-y: auto; padding: 12px 12px 4px; margin: -12px; scrollbar-width: thin; }
.frame {
  display: block;
  margin: 0;
  padding: 12px;
  background: var(--mat);
  border: 11px solid transparent;
  border-image: var(--walnut) 1;
  box-shadow: 0 18px 30px -16px rgba(30, 20, 10, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.06), inset 0 2px 8px rgba(0, 0, 0, 0.12);
}
.frame img { display: block; width: 100%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); }
.ref-zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.ref-zoom img { max-height: 42dvh; object-fit: contain; background: #eee7da; }
.ref-frame { position: relative; }
.placard {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  padding: 10px 12px 11px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-size: 12.5px;
  color: var(--ink-2);
}
.placard strong { font: 500 16px/1.25 var(--display); color: var(--ink); }
.placard-kicker { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--terra); }
.placard a { color: var(--ink-2); text-underline-offset: 2px; }

.status-card { padding: 16px 18px; }
.status-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.status { font-size: 12px; color: var(--muted); font-style: italic; font-family: var(--display); }
.status-list li.done .status { color: var(--sage); font-style: normal; font-family: var(--body); font-weight: 600; }
.status-list li.done .status::before { content: '✓ '; }

.easel-col { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; min-height: 0; }
.easel {
  position: relative;
  width: min(100%, calc((100dvh - var(--topbar) - 36px - var(--dock) - 14px) * 4 / 3));
  aspect-ratio: 4 / 3;
  flex: none;
  isolation: isolate;
  background-color: #fbf8f1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .44 0 0 0 0 .36 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(60, 40, 20, 0.1), 0 2px 0 #e5dccb, 0 4px 0 #d9ceb9, 0 34px 60px -28px rgba(50, 30, 15, 0.55);
  overflow: hidden;
}
.paint-layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stroke-layer { touch-action: none; cursor: none; }
.easel.locked .stroke-layer { cursor: default; }
.brush-cursor {
  --d: 20px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: var(--d);
  height: var(--d);
  margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
  border-radius: 50%;
  border: 1px solid rgba(20, 16, 12, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, width 0.1s, height 0.1s, margin 0.1s;
}
.brush-cursor.on { opacity: 1; }
.brush-cursor.point { border-radius: 0; border: 0; box-shadow: none; }
.brush-cursor.point::before, .brush-cursor.point::after { content: ''; position: absolute; background: var(--ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8); }
.brush-cursor.point::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.brush-cursor.point::after { top: 50%; left: 0; right: 0; height: 1px; }
.easel.locked .brush-cursor { display: none; }
.easel-veil {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(242, 235, 221, 0.66);
  backdrop-filter: blur(1.5px) saturate(0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.easel-veil.on { opacity: 1; pointer-events: auto; }
.easel-veil p { margin: 0; text-align: center; font: italic 400 30px/1.2 var(--display); font-variation-settings: 'SOFT' 100; }
.easel-veil small { display: block; margin-top: 8px; font: 400 14px/1.4 var(--body); color: var(--ink-2); }

.dock {
  --current: #2a3f9d;
  width: 100%;
  max-width: calc((100dvh - var(--topbar) - 36px - var(--dock) - 14px) * 4 / 3);
  min-height: var(--dock);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 22px;
  align-items: center;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sheet);
}
.palette { display: flex; flex-direction: column; gap: 10px; }
.swatches { display: grid; grid-template-columns: repeat(9, 28px); gap: 8px 9px; }
.swatches.extra { display: flex; align-items: center; gap: 9px; }
.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 55% 45% 52% 48% / 48% 55% 45% 52%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.42), transparent 42%), var(--c);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.15s;
}
.swatch:nth-child(3n) { border-radius: 46% 54% 44% 56% / 55% 45% 55% 45%; }
.swatch:nth-child(4n + 1) { border-radius: 52% 48% 58% 42% / 44% 52% 48% 56%; }
.swatch:hover { transform: scale(1.12) rotate(-6deg); }
.swatch.on { transform: scale(1.12); outline: 2px solid var(--ink); outline-offset: 2px; }
.swatch.small { width: 22px; height: 22px; }
.swatch.custom { position: relative; background: conic-gradient(from 20deg, #c63229, #f1c232, #5f7d2c, #23958f, #2a3f9d, #b03068, #c63229); overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.recent { display: flex; gap: 7px; min-height: 22px; padding-left: 9px; border-left: 1px solid var(--line); }
.current-color {
  margin-left: auto;
  width: 44px;
  height: 30px;
  border-radius: 999px 999px 999px 999px / 70% 60% 70% 60%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 45%), var(--current);
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--line);
}

.dock-controls { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tool-caption { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 42px; }
.tool-caption > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.tool-caption strong { font: italic 500 18px/1.2 var(--display); }
.tool-caption span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.slider { display: grid; grid-template-columns: 64px 1fr 40px; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-2); }
.slider output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); border-radius: 2px; }
input[type='range']::-moz-range-track { height: 2px; background: var(--line-strong); border-radius: 2px; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border-radius: 50%; background: var(--ink); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--ink); }
input[type='range']::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--ink); }
.history { display: flex; gap: 6px; flex: none; }
.history .icon-btn { width: 34px; height: 34px; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 30%, rgba(52, 44, 36, 0.92), rgba(18, 14, 11, 0.97));
  color: var(--on-wall);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
}
.intro.open { opacity: 1; visibility: visible; }
.intro-inner { text-align: center; display: flex; flex-direction: column; align-items: center; }
.intro-round { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ochre); }
.intro-numeral { font: italic 300 clamp(96px, 16vw, 170px)/0.9 var(--display); font-variation-settings: 'opsz' 144, 'SOFT' 100; margin: 6px 0 4px; }
.intro-theme { margin: 0 0 26px; font: italic 400 26px/1.2 var(--display); color: var(--on-wall-muted); }
.intro-frame { width: min(520px, 80vw); opacity: 0; transform: translateY(16px) scale(0.97); transition: opacity 0.8s 0.2s, transform 0.8s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1); border-image: var(--gilt) 1; }
.intro-frame.ready { opacity: 1; transform: none; }
.intro-frame img { max-height: 44dvh; object-fit: contain; margin: 0 auto; }
.intro-count { margin: 24px 0 0; font-size: 14px; color: var(--on-wall-muted); }
.intro-count b { color: var(--on-wall); font: 600 18px var(--body); font-variant-numeric: tabular-nums; }

/* ---------- Exposição e veredito ---------- */

.salon, .verdict {
  min-height: calc(100dvh - var(--topbar));
  color: var(--on-wall);
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 236, 200, 0.12), transparent 70%),
    linear-gradient(180deg, var(--wall-2), var(--wall) 60%, #1c2320);
  box-shadow: inset 0 -80px 80px -60px rgba(0, 0, 0, 0.5);
}
.salon .eyebrow, .verdict .eyebrow { color: var(--ochre); }
.salon-head {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 8px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}
.salon-head .sub { margin: 10px 0 0; color: var(--on-wall-muted); max-width: 520px; }
.salon-ref { width: 190px; flex: none; padding: 8px; border-width: 8px; transform: rotate(1.5deg); }
.salon-ref img { aspect-ratio: 4 / 3; object-fit: cover; }
.salon-ref figcaption { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; text-align: center; color: var(--muted); margin-top: 6px; }

.wall {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 32px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 64px 44px;
  align-items: start;
}
.wall .empty { grid-column: 1 / -1; text-align: center; font: italic 400 24px var(--display); color: var(--on-wall-muted); padding: 60px 0; }
.art-frame {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  animation: hang 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 120ms);
}
@keyframes hang { from { opacity: 0; transform: translateY(-18px) rotate(calc(var(--tilt, 0deg) * 4)); } }
.art-frame::before {
  content: '';
  position: absolute;
  inset: -70px -40px 20% -40px;
  background: radial-gradient(ellipse 55% 60% at 50% 0%, rgba(255, 238, 205, 0.2), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.art-frame:hover { transform: rotate(0deg) translateY(-4px); }
.art-frame .frame { width: 100%; cursor: zoom-in; box-shadow: 0 30px 40px -24px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.06), inset 0 2px 8px rgba(0, 0, 0, 0.14); }
.art-frame .frame:disabled { cursor: default; }
.art-frame .frame img { aspect-ratio: 4 / 3; object-fit: cover; }
.art-frame .blank { display: grid; place-items: center; aspect-ratio: 4 / 3; color: var(--muted); font: italic 15px var(--display); background: #efe8da; }
.art-frame .placard { align-self: center; min-width: 62%; max-width: 100%; text-align: center; margin-top: 16px; }
.art-frame.mine .placard strong { color: var(--terra); }
.art-frame .vote { align-self: center; margin-top: 14px; --fg: var(--on-wall); --bd: rgba(239, 231, 214, 0.4); }
.art-frame .vote:hover:not(:disabled) { --bg: var(--on-wall); --fg: var(--wall); --bd: var(--on-wall); }
.art-frame .vote.primary { --bg: var(--terra); --bd: var(--terra); --fg: #fff; }
.art-frame.voted .frame, .art-frame.winner .frame { border-image: var(--gilt) 1; }
.art-frame .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 7px; vertical-align: 1px; }
.points { font-weight: 600; color: var(--sage); }

.rosette {
  position: absolute;
  top: -22px;
  right: -16px;
  width: 74px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.4) rotate(-30deg);
  transition: opacity 0.3s, transform 0.45s cubic-bezier(0.3, 1.6, 0.4, 1);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.4));
}
.art-frame.voted .rosette, .art-frame.winner .rosette { opacity: 1; transform: rotate(8deg); }
.rosette svg { display: block; width: 100%; }
.rosette .tails { fill: var(--terra-dark); }
.rosette .petals { fill: var(--terra); stroke: #d0694e; stroke-width: 7; stroke-dasharray: 2.6 2.4; }
.rosette .core { fill: var(--ochre); stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; }
.rosette b {
  position: absolute;
  top: 38px;
  left: 50%;
  width: 38px;
  transform: translate(-50%, -50%);
  font: italic 600 10px/1.05 var(--display);
  color: #fff;
  text-align: center;
}

.verdict-grid { max-width: 1280px; margin: 0 auto; padding: 0 32px 64px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; align-items: start; }
.verdict-grid .wall { padding: 48px 0 40px; margin: 0; }
.scoreboard { position: sticky; top: calc(var(--topbar) + 24px); margin-top: 48px; padding: 22px; color: var(--ink); }
.scoreboard .eyebrow { color: var(--terra); }
#scoreboard li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); animation: enter 0.4s both; }
#scoreboard li:last-child { border-bottom: 0; }
#scoreboard li.me .artist-name { font-weight: 700; }
.gain { font-size: 12px; font-weight: 600; color: var(--sage); animation: rise 1.2s 0.6s both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.score { font: 600 18px/1 var(--display); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

/* ---------- Final ---------- */

.final { max-width: 1120px; margin: 0 auto; padding: 40px 24px 72px; text-align: center; }
.final-head .wordmark { margin: 0 auto 8px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); justify-content: center; align-items: end; gap: 18px; margin: 34px auto 10px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: rise 0.8s both; }
.step.place-1 { animation-delay: 0.6s; }
.step.place-2 { animation-delay: 0.3s; }
.step strong { font: 500 22px/1.2 var(--display); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .score { color: var(--muted); font-size: 15px; font-family: var(--body); text-align: center; }
.plinth {
  width: 100%;
  margin-top: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #faf6ee, #e2d8c5);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  box-shadow: inset 0 1px 0 #fff, 0 20px 30px -20px rgba(60, 40, 20, 0.5);
}
.plinth span { font: italic 400 44px/1 var(--display); color: var(--ink-2); }
.place-1 .plinth { height: 170px; }
.place-1 .plinth span { color: var(--terra); font-size: 64px; }
.place-2 .plinth { height: 120px; }
.place-3 .plinth { height: 88px; }
.place-1 .avatar { box-shadow: 0 0 0 4px var(--card), 0 0 0 6px var(--ochre), inset 0 -3px 6px rgba(0, 0, 0, 0.18); }
.standings { max-width: 440px; margin: 28px auto 0; text-align: left; }
.standings li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.standings .pos { color: var(--muted); font-size: 13px; width: 30px; text-align: right; }
.final-actions { margin: 34px 0 10px; }
.section-title { font-size: 28px; margin: 56px 0 0; }
.highlights { padding-top: 40px; text-align: left; }
.highlights .art-frame::before { display: none; }

/* ---------- Lightbox e aviso ---------- */

.lightbox { padding: 0; border: 0; background: transparent; max-width: 94vw; max-height: 92dvh; overflow: visible; }
.lightbox::backdrop { background: rgba(14, 11, 9, 0.88); backdrop-filter: blur(4px); }
.lightbox img { display: block; max-width: 92vw; max-height: 86dvh; border: 12px solid transparent; border-image: var(--gilt) 1; background: var(--mat); padding: 10px; }
.lightbox-close { position: absolute; top: -14px; right: -14px; z-index: 1; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--card); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsivo ---------- */

@media (max-width: 1100px) {
  .studio-grid { height: auto; grid-template-columns: 70px minmax(0, 1fr); }
  .easel-col { grid-column: 2; grid-row: 1; }
  .ref-col { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; overflow: visible; margin: 0; padding: 0; }
  .easel, .dock { width: 100%; max-width: none; }
  .tools { grid-row: 1 / span 2; position: sticky; top: calc(var(--topbar) + 18px); align-self: start; }
  .verdict-grid { grid-template-columns: minmax(0, 1fr); }
  .scoreboard { position: static; margin-top: 0; }
}

@media (max-width: 820px) {
  .topbar { grid-template-columns: auto 1fr; padding: 0 16px; }
  .topbar-mid { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; padding-bottom: 10px; }
  .topbar:has(.topbar-mid.on) { height: auto; padding-top: 10px; }
  .topbar-end .room-chip { display: none; }
  .lobby-grid { grid-template-columns: 1fr; padding: 28px 16px 48px; }
  .steps { grid-template-columns: 1fr; margin-top: 48px; }
  .home-inner { padding: 56px 16px 48px; }
  .dock { grid-template-columns: 1fr; }
  .salon-head { flex-direction: column; align-items: flex-start; padding: 28px 16px 0; }
  .wall { padding: 36px 16px 56px; }
  .verdict-grid { padding: 0 16px 48px; }
}

@media (max-width: 640px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 24px; gap: 14px; }
  .tools { grid-row: auto; position: static; flex-direction: row; overflow-x: auto; order: 2; }
  .tool-btn { min-width: 60px; }
  .tools-sep { width: 1px; height: auto; margin: 8px 4px; }
  .easel-col, .ref-col { grid-column: 1; grid-row: auto; }
  .easel-col { order: 1; }
  .ref-col { order: 3; grid-template-columns: 1fr; }
  .swatches { grid-template-columns: repeat(auto-fill, 28px); }
  .podium { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .step strong { font-size: 16px; }
  .avatar.large { --size: 56px; }
  .room-card, .settings-card, .entry { padding: 22px 18px; }
  .join { flex: 1; }
  .join input { flex: 1; width: auto; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Treino livre ---------- */

.segmented.compact { gap: 4px; }
.segmented.compact button { padding: 6px 12px; font-size: 13px; }
.shortcuts { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); display: grid; gap: 7px; }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  font: 600 11px/1.3 var(--body);
  text-align: center;
  color: var(--ink);
}
.practice-link { display: inline-block; margin-top: 16px; font-size: 14px; color: var(--ink-2); text-underline-offset: 3px; }
.practice-link:hover { color: var(--terra); }

@media (max-width: 820px) {
  .practice .topbar { height: auto; padding: 10px 16px; }
  .practice .topbar-end { grid-column: 1 / -1; flex-wrap: wrap; justify-content: flex-start; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.select-wrap select {
  appearance: none;
  padding: 7px 32px 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23666' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 13px center;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.select-wrap select:hover { border-color: var(--ink); }
.select-wrap select:focus-visible { outline: 2px solid var(--ultra); outline-offset: 3px; }
