/* ==========================================================================
   《调色间》Palette — visual language
   Spec 32: not a children's drawing app, not professional design software,
   not an AI image tool. A quiet studio: wood, linen, pigment residue.
   Everything is low contrast on purpose; the painting must be the brightest
   thing on screen.
   ========================================================================== */

:root {
  /* room */
  --room: #17130f;
  --room-2: #221b15;
  --room-3: #2e251c;
  --wood: #6b4b31;
  --wood-dark: #4a3323;
  --wood-light: #85603f;

  /* surfaces */
  --linen: #efe7d8;
  --linen-dark: #ded2bd;
  --ground: #d7c6ac;
  --paper: #f3ede1;

  /* ink */
  --ink: #2a2118;
  --ink-soft: #6a5b4a;
  --ink-faint: #9c8b76;
  --ink-on-dark: #e9dfcd;
  --ink-on-dark-soft: #a9998a;

  /* accents, used sparingly */
  --umber: #5a3a22;
  --terracotta: #a8613c;
  --sage: #6c7a5c;

  --shadow-soft: 0 18px 44px rgba(0, 0, 0, 0.45);
  --shadow-frame: 0 26px 60px rgba(0, 0, 0, 0.55);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "SimSun", "Noto Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--room);
  color: var(--ink-on-dark);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overscroll-behavior: none;
  touch-action: manipulation;
}

#app { position: fixed; inset: 0; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 520ms var(--ease);
}
.screen.is-active { opacity: 1; pointer-events: auto; }

/* the room itself: one soft light high on the wall */
.room-light {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 236, 200, 0.10), transparent 60%),
    radial-gradient(90% 70% at 50% 120%, rgba(0, 0, 0, 0.5), transparent 70%),
    linear-gradient(180deg, var(--room-2), var(--room));
  pointer-events: none;
}

.room-grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* ==========================================================================
   type
   ========================================================================== */

h1, h2, h3 { margin: 0; font-weight: 400; }

.title-serif {
  font-family: var(--serif);
  letter-spacing: 0.02em;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-on-dark-soft);
}

.muted { color: var(--ink-on-dark-soft); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }

/* ==========================================================================
   buttons & inputs
   ========================================================================== */

.btn {
  appearance: none;
  border: 1px solid rgba(233, 223, 205, 0.22);
  background: rgba(233, 223, 205, 0.04);
  color: var(--ink-on-dark);
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 220ms var(--ease), border-color 220ms var(--ease), transform 160ms var(--ease);
}
.btn:hover { background: rgba(233, 223, 205, 0.10); border-color: rgba(233, 223, 205, 0.36); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn--primary {
  background: rgba(233, 223, 205, 0.92);
  color: #241c14;
  border-color: transparent;
  font-weight: 500;
}
.btn--primary:hover { background: #f6efe2; }
.btn--quiet { border-color: transparent; background: transparent; color: var(--ink-on-dark-soft); }
.btn--quiet:hover { color: var(--ink-on-dark); background: rgba(233, 223, 205, 0.06); }
.btn--ghost { border-color: rgba(233, 223, 205, 0.16); background: transparent; }
.btn--danger { color: #d9a08c; border-color: rgba(217, 160, 140, 0.3); }
.btn--danger:hover { background: rgba(217, 160, 140, 0.12); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* minimal range input, styled as a pencil line */
input[type="range"] {
  appearance: none;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: rgba(233, 223, 205, 0.28);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--ink-on-dark);
}
input[type="range"]::-moz-range-track { height: 1px; background: rgba(233, 223, 205, 0.28); }
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border: 0; border-radius: 50%; background: var(--ink-on-dark);
}

/* ==========================================================================
   overlay / panel / toast
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 9, 6, 0.62);
  backdrop-filter: blur(6px) saturate(0.9);
  opacity: 0;
  transition: opacity 420ms var(--ease);
}
.overlay.is-in { opacity: 1; }

.panel {
  max-width: min(720px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: linear-gradient(180deg, #241d16, #1c1712);
  border: 1px solid rgba(233, 223, 205, 0.12);
  box-shadow: var(--shadow-soft);
  padding: 30px 34px 26px;
  border-radius: 3px;
  transform: translateY(10px) scale(0.99);
  transition: transform 480ms var(--ease);
}
.overlay.is-in .panel { transform: none; }
.panel__title { font-family: var(--serif); font-size: 25px; margin-bottom: 8px; }
.panel__subtitle { color: var(--ink-on-dark-soft); font-size: 13.5px; margin: 0 0 18px; line-height: 1.7; }
.panel__body { color: var(--ink-on-dark); }
.panel__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }

.toast-host {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(28, 22, 16, 0.94);
  border: 1px solid rgba(233, 223, 205, 0.14);
  color: var(--ink-on-dark);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 2px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
  box-shadow: var(--shadow-soft);
}
.toast.is-in { opacity: 1; transform: none; }

/* problems: always visible, never a mystery --------------------------------- */

.problem-host {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(560px, 92vw);
}
.problem {
  background: linear-gradient(180deg, #33261c, #241b13);
  border: 1px solid rgba(232, 160, 140, 0.42);
  border-left: 3px solid #c9705a;
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
  border-radius: 3px;
}
.problem__title { font-family: var(--serif); font-size: 15px; color: #f0d9cf; }
.problem__detail {
  margin: 8px 0 0;
  font: 12px/1.6 ui-monospace, Consolas, monospace;
  color: #d9c3b6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}
.problem__actions { display: flex; gap: 8px; margin-top: 12px; }

/* ==========================================================================
   1. home
   ========================================================================== */

.home {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}
.home__inner { position: relative; z-index: 2; max-width: 780px; width: 100%; }
.home__mark {
  font-family: var(--serif);
  font-size: clamp(44px, 7vw, 76px);
  letter-spacing: 0.06em;
  line-height: 1.1;
}
.home__latin {
  font-size: 12px;
  letter-spacing: 0.5em;
  color: var(--ink-on-dark-soft);
  margin-top: 14px;
  text-transform: uppercase;
}
.home__line {
  margin: 26px auto 0;
  max-width: 460px;
  color: var(--ink-on-dark-soft);
  font-size: 14px;
  line-height: 2;
}

.home__entries {
  margin: 52px auto 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 420px;
}
.entry {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-on-dark);
  font-family: var(--sans);
  text-align: left;
  padding: 20px 22px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  cursor: pointer;
  border-top: 1px solid rgba(233, 223, 205, 0.10);
  transition: background 260ms var(--ease), padding-left 260ms var(--ease);
}
.entry:last-child { border-bottom: 1px solid rgba(233, 223, 205, 0.10); }
.entry:hover { background: rgba(233, 223, 205, 0.05); padding-left: 30px; }
.entry__label { font-family: var(--serif); font-size: 21px; letter-spacing: 0.04em; }
.entry__sub { font-size: 12.5px; color: var(--ink-on-dark-soft); margin-top: 5px; }
.entry__idx { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.2em; }

.home__swatches {
  margin-top: 54px;
  display: flex;
  gap: 10px;
  justify-content: center;
  opacity: 0.85;
}
.home__swatch {
  width: 16px; height: 16px; border-radius: 50%;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.35);
}

.home__principles {
  margin-top: 46px;
  font-family: var(--serif);
  font-size: 13.5px;
  line-height: 2.3;
  color: var(--ink-faint);
}

.home__drop {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 15, 10, 0.82);
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.1em;
}
.home__drop.is-over { display: flex; }
.home-studies { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:24px; font-size:12px; color:#a9998a; }
.home-studies button { border:0; border-bottom:1px solid #6f6558; background:none; color:#ded5bc; padding:5px 0; cursor:pointer; font:inherit; }

/* Photo-to-paper workspace. The effect is a reference, the paint remains empty. */
.study-screen { background:#e9e5d9; color:#393f35; overflow:auto; }
.study-header { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:24px 38px; border-bottom:1px solid #cdcbbd; flex-shrink:0; }
.study-header .ghost-btn { color:#525b4a; opacity:1; }
.study-step { color:#8a8c7b; font-size:11px; letter-spacing:.12em; }
.study-workspace { display:grid; grid-template-columns:minmax(0,1fr) 345px; flex:1; min-height:0; width:100%; max-width:1660px; margin:auto; }
.study-main { display:flex; flex-direction:column; align-items:center; min-height:0; padding:28px 42px 20px; background:radial-gradient(ellipse at 40% 25%,#f0ede3,#dddacf); }
.study-tabs { display:flex; align-items:center; justify-content:center; gap:24px; margin-bottom:20px; flex-shrink:0; }
.study-tab { border:0; border-bottom:1px solid transparent; background:none; padding:9px 0; color:#8c8c7b; font-size:12px; cursor:pointer; }
.study-tab.is-on { color:#364c3c; border-color:#5e715e; }
.study-preview { flex:1; min-height:260px; width:100%; display:flex; align-items:center; justify-content:center; padding:12px; }
.study-preview canvas { max-width:100%; max-height:calc(100vh - 220px); height:auto; width:auto; object-fit:contain; box-shadow:0 20px 36px #33362520,0 1px 3px #33362518; cursor:pointer; }
.study-preview canvas.is-lasso { cursor:crosshair; touch-action:none; }
.study-caption { font-size:11px; text-align:center; color:#858576; margin:22px 0 0; line-height:1.8; flex-shrink:0; }
.study-side { background:#f5f2e8; padding:28px 28px 22px; overflow:auto; display:flex; flex-direction:column; gap:0; border-left:1px solid #d5d2c5; }
.study-side .eyebrow { color:#8b917f; font-size:9px; letter-spacing:.24em; }
.study-side h1 { font-size:28px; line-height:1.55; white-space:pre-line; margin:17px 0 12px; color:#404c3d; }
.study-intro { font-size:12px; line-height:1.9; color:#888a79; margin:0 0 8px; }
.study-side h2 { font-size:12px; color:#525d49; margin:21px 0 12px; }
.study-levels { display:flex; gap:6px; }
.study-level { display:flex; flex-direction:column; gap:6px; flex:1; border:1px solid #dcddd1; background:transparent; color:#79806d; text-align:left; padding:12px 9px; cursor:pointer; border-radius:3px; }
.study-level b { font-size:12px; font-weight:500; }.study-level span { font-size:10px; line-height:1.7; }
.study-level.is-on { border-color:#6f8262; background:#e7eddf; color:#496039; }
.study-margin { display:flex; gap:18px; align-items:center; }.study-margin input { flex:1; width:0; accent-color:#72855e; }.study-margin span { font-size:11px; color:#8e947f; }
.study-side input[type=range]::-webkit-slider-runnable-track { background:#c0c5af; }
.study-side input[type=range]::-webkit-slider-thumb { background:#667957; border:0; }
.study-lasso-actions { display:flex; gap:7px; flex-wrap:wrap; margin-top:14px; }
.study-side .btn { color:#60714f; border-color:#bfc8b2; font-size:11px; padding:9px 10px; }
.study-side .btn:hover { background:#e7eddc; }.study-side .btn--quiet { border:0; }
.study-side .btn--primary { color:#f6f5eb; background:#5d7450; border:0; font-size:13px; padding:15px 12px; margin-top:8px; }
.study-side .btn--primary:hover { background:#4b623f; }.study-side .btn:disabled { cursor:default; }
.study-ground { display:flex; align-items:center; gap:7px; font-size:10px; line-height:1.6; color:#8d927f; margin-top:12px; }
.study-ground input { accent-color:#758667; }
.study-colors { display:flex; gap:14px; }.study-color { width:33px; height:33px; border-radius:50%; border:3px solid #f5f2e8; outline:1px solid #cecdbc; cursor:pointer; }
.study-color:hover { outline:2px solid #81966d; }.study-recipe { min-height:34px; font-size:10px; color:#8c927e; line-height:1.8; margin:13px 0 0; }
.study-order { font-size:10px; color:#7b866b; margin:20px 0 10px; line-height:1.8; }
.study-progress { font-size:10px; color:#8e957d; min-height:15px; margin:3px 0; }
.study-side .btn-row { margin-top:6px; gap:8px; justify-content:center; }
.study-actions { position:sticky; bottom:-22px; background:#f5f2e8; padding:10px 0; margin-top:auto; }
.study-actions>.btn--primary { width:100%; }
.study-side select { border:1px solid #c8cebc; padding:6px 9px; background:transparent; color:#6d7c5e; font:inherit; font-size:11px; margin-bottom:9px; width:100%; }
.study-reference-card { position:absolute; left:24px; top:86px; width:190px; z-index:6; background:#f0ecd9; border:7px solid #f0ecd9; box-shadow:0 9px 20px #0004; }
.study-reference-card img { display:block; width:100%; }.study-reference-card figcaption { color:#7c816c; text-align:center; font-size:10px; padding:6px 0 0; }
.studio__panel .study-reference-card { position:static; width:auto; margin:12px 0; box-shadow:none; }
.effect-thumb { border:0; padding:0; width:100%; background:none; cursor:pointer; display:block; }
.studio--study:not(.show-more-tools) .tool[data-tool=fan],.studio--study:not(.show-more-tools) .tool[data-tool=detail] { display:none; }
.studio--study.studio--focus .study-reference-card { display:none; }
.studio--study .studio__stage { top:45px; bottom:190px; padding:18px 380px 12px 220px; }
.studio--study .studio__easel canvas { width:100%; height:100%; }
.studio--study .studio__tubes { left:26px; bottom:42px; width:255px; }
.studio--study .studio__tools { left:310px; right:400px; bottom:45px; gap:8px; flex-wrap:wrap; justify-content:center; }
.studio--study .presets { display:none; }
.studio--study.show-more-tools .presets { display:flex; }
.studio--study .tool { min-width:62px; padding:9px 8px; }
.studio--study .tube__en { display:none; }
.studio--study .size-control input { width:70px; }
.studio--study .study-reference-card { width:160px; margin:0; left:25px; top:85px; }
@media(max-width:900px){.studio--study .studio__stage{top:40px;bottom:250px;padding:10px 180px 10px 12px}.studio--study .studio__tools{left:12px;right:12px;bottom:25px}.studio--study .studio__tubes{left:12px;bottom:135px;width:230px}.studio--study .study-reference-card{left:auto;right:14px;top:55px;width:130px}.studio--study .studio__palette{right:12px;bottom:140px;width:220px;height:145px}}
@media(max-width:1000px) { .study-workspace { grid-template-columns:minmax(0,1fr) 300px; }.study-side { padding:24px 20px; }.study-main { padding:24px 20px; }.study-header { padding:18px 20px; }.study-step { display:none; } }
@media(max-width:720px) { .study-workspace { display:flex; flex-direction:column; min-height:auto; }.study-main { padding:18px 12px 22px; }.study-side { overflow:visible; padding:25px; border-top:1px solid #d5d2c5; border-left:0; }.study-preview { min-height:230px; }.study-preview canvas { max-height:52vh; }.study-tabs { gap:22px; margin-bottom:5px; }.study-side h1 { font-size:24px; }.study-header .title-serif { font-size:13px; }.study-header { padding:14px; }.home-studies { gap:10px; flex-wrap:wrap; } }

/* orientation picker */
.shapes { display: flex; gap: 18px; margin: 6px 0 4px; }
.shape {
  appearance: none;
  border: 1px solid rgba(233, 223, 205, 0.18);
  background: transparent;
  color: var(--ink-on-dark);
  padding: 16px 18px 12px;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 92px;
  transition: border-color 220ms var(--ease), background 220ms var(--ease);
}
.shape:hover { border-color: rgba(233, 223, 205, 0.4); }
.shape.is-on { border-color: rgba(233, 223, 205, 0.85); background: rgba(233, 223, 205, 0.08); }
.shape__box { border: 1px solid currentColor; opacity: 0.8; }
.shape__label { font-size: 12px; letter-spacing: 0.08em; color: var(--ink-on-dark-soft); }

/* ==========================================================================
   2. crop
   ========================================================================== */

.topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  gap: 16px;
}
.topbar__title { font-family: var(--serif); font-size: 17px; letter-spacing: 0.06em; }
.topbar__hint { font-size: 12px; color: var(--ink-on-dark-soft); }

.crop { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; min-height: 0; }
.crop__stage {
  position: relative;
  box-shadow: var(--shadow-frame);
  background: #0d0a07;
  cursor: grab;
  touch-action: none;
}
.crop__stage:active { cursor: grabbing; }
.crop__stage canvas { display: block; width: 100%; height: 100%; }
.crop__frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10, 7, 4, 0.72);
  outline: 1px solid rgba(243, 237, 225, 0.5);
}
.crop__grid { position: absolute; inset: 0; pointer-events: none; opacity: 0.22; }
.crop__grid i { position: absolute; background: #f3ede1; }
.crop__grid i.v { top: 0; bottom: 0; width: 1px; }
.crop__grid i.h { left: 0; right: 0; height: 1px; }

.bottombar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px 24px;
  flex-wrap: wrap;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  appearance: none;
  border: 1px solid rgba(233, 223, 205, 0.18);
  background: transparent;
  color: var(--ink-on-dark-soft);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 220ms var(--ease);
}
.chip:hover { color: var(--ink-on-dark); border-color: rgba(233, 223, 205, 0.4); }
.chip.is-on { color: #241c14; background: rgba(233, 223, 205, 0.9); border-color: transparent; }

/* ==========================================================================
   3. prepare (underpainting)
   ========================================================================== */

.prepare { flex: 1; display: flex; gap: 34px; padding: 0 40px 30px; min-height: 0; align-items: stretch; }
.prepare__preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}
.prepare__preview canvas {
  max-width: 100%;
  max-height: 100%;
  box-shadow: var(--shadow-frame);
  border-radius: 1px;
}
.prepare__side {
  width: 300px;
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 8px;
}
.levels { display: flex; flex-direction: column; gap: 8px; }
.level {
  appearance: none;
  text-align: left;
  border: 1px solid rgba(233, 223, 205, 0.16);
  background: transparent;
  color: var(--ink-on-dark);
  padding: 14px 16px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 240ms var(--ease);
}
.level:hover { border-color: rgba(233, 223, 205, 0.36); }
.level.is-on { border-color: rgba(233, 223, 205, 0.75); background: rgba(233, 223, 205, 0.07); }
.level__name { font-family: var(--serif); font-size: 16px; letter-spacing: 0.06em; }
.level__sub { font-size: 12px; color: var(--ink-on-dark-soft); margin-top: 5px; line-height: 1.6; }

.progress {
  height: 2px;
  background: rgba(233, 223, 205, 0.14);
  overflow: hidden;
  border-radius: 2px;
}
.progress__bar { height: 100%; width: 0; background: rgba(233, 223, 205, 0.85); transition: width 320ms var(--ease); }
.progress__label { font-size: 12px; color: var(--ink-on-dark-soft); margin-top: 10px; letter-spacing: 0.06em; }

.meta-list { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--ink-on-dark-soft); }
.meta-list b { color: var(--ink-on-dark); font-weight: 500; }

/* ==========================================================================
   4. studio
   ========================================================================== */

.studio { background: transparent; }

/* The supplied artwork belongs to the room, never to the user's paint layer. */
.studio {
  background: linear-gradient(#21170ba3, #21170b70), url('../美术UI/美术资产/1.工作台环境资产/木桌背景.png') center / cover;
}
.studio__bench { opacity: .4; }
.studio__environment { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.studio__rag { position: absolute; right: 5px; bottom: 6px; width: 180px; opacity: .65; }
.studio__water { position: absolute; right: 32px; top: 74px; width: 115px; opacity: .8; }
.palette__art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
.studio__palette.has-art .palette__wood,.studio__palette.has-art .palette__thole,.studio__palette.has-art .palette__label { visibility: hidden; }
.studio__palette.has-art .palette__surface { inset: 14% 11% 15% 31%; background: none; box-shadow: none; }
.tube__art { display: none; pointer-events: none; }
.tube.has-art .tube__body { display: none; }
.tube.has-art .tube__art { display: block; width: 38px; height: 35px; object-fit: contain; order: -1; }
.tool__art { display: none; pointer-events: none; }
.tool.has-art > svg { display: none; }
.tool.has-art .tool__art { display: block; width: 48px; height: 66px; object-fit: cover; object-position: center; order: -1; }
.studio__easel { outline: 6px solid #967049; outline-offset: 0; }
.studio--focus .studio__environment { display: none; }
.study-detail-hint { font-size: 11px; color: #7b866b; line-height: 1.7; margin: 8px 0; }
.study-lasso-actions { flex-wrap: wrap; }
.study-preview canvas.is-lasso { touch-action: none; }

.studio__bench {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 190px;
  background:
    linear-gradient(180deg, rgba(107, 75, 49, 0.0), rgba(107, 75, 49, 0.30) 30%, rgba(74, 51, 35, 0.85)),
    linear-gradient(180deg, var(--wood-dark), #3b281b);
  border-top: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: 0 -30px 60px rgba(0, 0, 0, 0.45);
  z-index: 1;
}
.studio__bench::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(0,0,0,0.10) 0 1px, transparent 1px 7px);
  opacity: 0.5;
}

.studio__stage {
  position: absolute;
  left: 0; right: 0;
  top: 0;
  bottom: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  /* leave the palette its corner, the way it lies on a real bench */
  padding: 22px 390px 10px 24px;
}
.studio__easel {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  box-shadow: var(--shadow-frame);
  background: var(--linen);
  line-height: 0;
}
.studio__easel canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
.studio__easel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), inset 0 0 40px rgba(80, 60, 40, 0.10);
}

/* palette ------------------------------------------------------------------ */

.studio__palette {
  position: absolute;
  right: 26px;
  bottom: 74px;
  width: 400px;
  height: 264px;
  z-index: 5;
  filter: drop-shadow(0 22px 34px rgba(0, 0, 0, 0.5));
}
.palette__wood {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(120% 100% at 30% 20%, #9a7048, #6b4b31 55%, #4a3323 100%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25), inset 0 3px 14px rgba(255, 220, 170, 0.16);
}
.palette__thole {
  position: absolute;
  left: 26px;
  top: 50%;
  width: 34px; height: 34px;
  margin-top: -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2b1e14, #120c07);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 220, 170, 0.12);
}
.palette__surface {
  position: absolute;
  inset: 8px 10px 8px 62px;
  border-radius: 50% / 50%;
  overflow: hidden;
  cursor: crosshair;
  background: rgba(240, 232, 216, 0.06);
  box-shadow: inset 0 0 30px rgba(60, 40, 25, 0.35);
}
.palette__surface canvas { display: block; width: 100%; height: 100%; }
.palette__label {
  position: absolute;
  left: 78px;
  bottom: 12px;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: rgba(60, 40, 25, 0.75);
  pointer-events: none;
  text-transform: uppercase;
}

/* tubes -------------------------------------------------------------------- */

.studio__tubes {
  position: absolute;
  left: 190px;
  bottom: 22px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 10px;
  width: 330px;
}
.tube {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 2px;
  cursor: pointer;
  color: var(--ink-on-dark);
  transition: background 200ms var(--ease), transform 200ms var(--ease);
  text-align: left;
}
.tube:hover { background: rgba(233, 223, 205, 0.10); transform: translateY(-1px); }
.tube.is-carrying { background: rgba(233, 223, 205, 0.16); }
.tube__body {
  width: 12px; height: 26px;
  border-radius: 2px 2px 3px 3px;
  background: linear-gradient(180deg, #cfc7b8, #9a9285);
  position: relative;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}
.tube__body::before {
  content: "";
  position: absolute;
  left: 1px; right: 1px; top: 5px; bottom: 3px;
  background: var(--tube-colour, #888);
  border-radius: 1px;
}
.tube__body::after {
  content: "";
  position: absolute;
  left: 3px; right: 3px; top: -1px; height: 5px;
  background: #6e6659;
  border-radius: 2px 2px 0 0;
}
.tube__text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tube__cn { font-size: 12px; letter-spacing: 0.06em; }
.tube__en { font-size: 9px; color: var(--ink-on-dark-soft); letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.blob-ghost {
  position: fixed;
  z-index: 60;
  width: 46px; height: 46px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.7);
  opacity: 0;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  filter: blur(0.3px) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
}
.blob-ghost.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* tools -------------------------------------------------------------------- */

.studio__tools {
  position: absolute;
  right: 432px;
  bottom: 40px;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.tool {
  appearance: none;
  border: 1px solid rgba(233, 223, 205, 0.16);
  background: rgba(20, 14, 9, 0.35);
  color: var(--ink-on-dark-soft);
  padding: 9px 11px 7px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 74px;
  transition: all 220ms var(--ease);
}
.tool:hover { color: var(--ink-on-dark); border-color: rgba(233, 223, 205, 0.36); }
.tool.is-on { color: var(--ink-on-dark); border-color: rgba(233, 223, 205, 0.7); background: rgba(233, 223, 205, 0.10); }
.tool svg { display: block; }
.tool__name { font-size: 11px; letter-spacing: 0.06em; }
.tool__load {
  width: 100%;
  height: 3px;
  background: rgba(233, 223, 205, 0.18);
  border-radius: 2px;
  overflow: hidden;
}
.tool__load i { display: block; height: 100%; width: 0; background: var(--load-colour, #d9cdb6); transition: width 140ms linear; }

.size-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  color: var(--ink-on-dark-soft);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  padding-bottom: 8px;
}
.size-control input { width: 96px; }

/* 手感 preset chips (P1-B) ------------------------------------------------- */

.presets {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 0 8px;
  max-width: 300px;
}
.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.preset-row__label {
  flex: 0 0 30px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--ink-on-dark-soft);
}
.preset-row .chips { gap: 4px; }
.chip--preset {
  padding: 3px 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* edge controls ------------------------------------------------------------ */

.edge {
  position: absolute;
  z-index: 30;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 380ms var(--ease), transform 380ms var(--ease);
  pointer-events: none;
}
.edge.is-near { opacity: 1; transform: none; pointer-events: auto; }
.edge--tl { top: 16px; left: 20px; display: flex; gap: 8px; align-items: center; }
.edge--tr { top: 16px; right: 20px; display: flex; gap: 8px; align-items: center; }
.edge--bl { bottom: 14px; left: 20px; display: flex; gap: 14px; align-items: center; }
.edge--br { bottom: 12px; right: 22px; }

.ghost-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-on-dark-soft);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 2px;
  transition: color 200ms var(--ease), background 200ms var(--ease);
}
.ghost-btn:hover { color: var(--ink-on-dark); background: rgba(233, 223, 205, 0.08); }
.ghost-btn.is-on { color: var(--ink-on-dark); }
.ghost-btn:disabled { opacity: 0.35; cursor: default; }

.studio__status {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--ink-on-dark-soft);
}
.studio__status b { color: var(--ink-on-dark); font-weight: 500; }

/* reference ---------------------------------------------------------------- */

.studio__reference {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(38vw, 460px);
  z-index: 20;
  transform: translateX(103%);
  transition: transform 620ms var(--ease);
  pointer-events: none;
  background: linear-gradient(90deg, rgba(20, 14, 9, 0), rgba(20, 14, 9, 0.85) 22%);
  padding: 22px 22px 22px 60px;
  display: flex;
  align-items: center;
}
.studio__reference.is-on { transform: none; }
.studio__reference img {
  width: 100%;
  max-height: 84vh;
  object-fit: contain;
  box-shadow: var(--shadow-frame);
  border: 6px solid #f3ede1;
  background: #f3ede1;
}
.studio__reference figcaption {
  position: absolute;
  bottom: 30px;
  left: 60px;
  right: 22px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-on-dark-soft);
}

.studio__hint {
  position: absolute;
  left: 50%;
  bottom: 300px;
  transform: translateX(-50%);
  z-index: 25;
  font-family: var(--serif);
  font-size: 15px;
  color: rgba(233, 223, 205, 0.82);
  background: rgba(20, 14, 9, 0.6);
  padding: 12px 20px;
  border-radius: 2px;
  text-align: center;
  line-height: 1.8;
  opacity: 0;
  transition: opacity 600ms var(--ease);
  pointer-events: none;
  max-width: 460px;
}
.studio__hint.is-on { opacity: 1; }

.pick-swatch {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  margin-right: 9px;
  vertical-align: -1px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* left panel: the guide and the surface (UI 说明 §9–14) -------------------- */

.studio__panel {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) translateX(-14px);
  width: 236px;
  z-index: 28;
  padding: 20px 20px 22px 22px;
  background: linear-gradient(90deg, rgba(24, 18, 12, 0.94), rgba(24, 18, 12, 0.74));
  border-right: 1px solid rgba(233, 223, 205, 0.10);
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms var(--ease), transform 420ms var(--ease);
}
.studio__panel.is-near { opacity: 1; transform: translateY(-50%); pointer-events: auto; }
.studio__panel input[type="range"] { width: 100%; }
.panel-row { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.chips--stack { display: flex; flex-wrap: wrap; gap: 6px; }
.chips--stack .chip { padding: 6px 12px; font-size: 12px; }
.panel-sect { margin-bottom: 14px; }
.panel-sect:last-of-type { margin-bottom: 0; }
.panel-sect .eyebrow { margin-bottom: 8px; }

/* 原图参考 thumbnail (第二轮退回 §9) --------------------------------------- */

.ref-thumb {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(233, 223, 205, 0.28);
  background: rgba(243, 237, 225, 0.9);
  cursor: zoom-in;
  overflow: hidden;
  transition: border-color 220ms var(--ease), transform 220ms var(--ease);
}
.ref-thumb:hover { border-color: rgba(233, 223, 205, 0.6); transform: translateY(-1px); }
.ref-thumb.is-on { border-color: rgba(233, 223, 205, 0.85); }
.ref-thumb__img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  background: #efe8da;
}
.ref-thumb__cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 4px 6px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-align: center;
  color: rgba(243, 237, 225, 0.92);
  background: linear-gradient(0deg, rgba(20, 14, 9, 0.78), rgba(20, 14, 9, 0));
}
.ref-swap { margin-top: 8px; width: 100%; }

/* brush cursor (UI 说明 §37) ---------------------------------------------- */

.studio__cursor {
  position: fixed;
  z-index: 40;
  border-radius: 50%;
  border: 1px solid rgba(250, 245, 235, 0.75);
  box-shadow: 0 0 0 1px rgba(30, 22, 14, 0.5), inset 0 0 0 1px rgba(30, 22, 14, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms var(--ease), width 90ms linear, height 90ms linear;
}
.studio__cursor.is-on { opacity: 0.9; }
.studio__cursor.is-pick {
  border-style: dashed;
  border-color: rgba(250, 245, 235, 0.9);
}
.studio__cursor-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  height: 30%;
  min-width: 3px;
  min-height: 3px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #b9ab93;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* focus mode (UI 说明 §31 / §32) ------------------------------------------ */

.studio--focus .edge,
.studio--focus .studio__panel,
.studio--focus .studio__tubes,
.studio--focus .studio__reference {
  opacity: 0 !important;
  pointer-events: none !important;
}
.studio--focus .studio__bench { opacity: 0.5; }
.studio--focus .studio__palette { filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.55)); }
.studio--focus .studio__cursor { opacity: 0.95; }

.studio.is-panning { cursor: grabbing; }
.studio.is-panning .studio__easel { cursor: grabbing; }
.studio__easel { cursor: crosshair; }

.studio__toastline {
  position: absolute;
  left: 50%;
  top: 64px;
  transform: translateX(-50%);
  z-index: 26;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: rgba(233, 223, 205, 0.9);
  opacity: 0;
  transition: opacity 400ms var(--ease);
  pointer-events: none;
  font-family: var(--serif);
}
.studio__toastline.is-on { opacity: 1; }

/* ==========================================================================
   5. finish
   ========================================================================== */

.finish { align-items: center; justify-content: center; padding: 40px 24px; }
.finish__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  max-height: 100%;
}
.finish__frame {
  position: relative;
  padding: 14px;
  background: linear-gradient(160deg, #3a2a1d, #241a12);
  box-shadow: var(--shadow-frame);
  border: 1px solid rgba(233, 223, 205, 0.14);
  animation: hang 1200ms var(--ease) both;
}
@keyframes hang {
  from { opacity: 0; transform: translateY(-14px) scale(1.06); }
  to { opacity: 1; transform: none; }
}
.finish__frame img,
.finish__frame canvas {
  display: block;
  max-width: min(78vw, 900px);
  max-height: 62vh;
  width: auto;
  height: auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.finish__caption { text-align: center; font-family: var(--serif); }
.finish__caption .by { font-size: 19px; letter-spacing: 0.05em; }
.finish__caption .date { font-size: 12.5px; color: var(--ink-on-dark-soft); margin-top: 8px; letter-spacing: 0.14em; }
.finish__caption .time { font-size: 12.5px; color: var(--ink-on-dark-soft); margin-top: 4px; letter-spacing: 0.14em; }

/* ==========================================================================
   6. gallery
   ========================================================================== */

.gallery { padding: 0; }
.gallery__wall {
  flex: 1;
  overflow-y: auto;
  padding: 26px 46px 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 46px 40px;
  align-content: flex-start;
}
.gallery__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ink-on-dark-soft);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 2;
}
.work {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  color: var(--ink-on-dark);
  width: 260px;
}
.work__frame {
  position: relative;
  padding: 10px;
  background: linear-gradient(160deg, #3a2a1d, #241a12);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.5);
  transition: transform 420ms var(--ease), box-shadow 420ms var(--ease);
}
.work:hover .work__frame { transform: translateY(-4px); box-shadow: 0 26px 46px rgba(0, 0, 0, 0.6); }
.work__frame img { display: block; width: 100%; height: auto; }
.work__label { text-align: left; font-family: var(--serif); font-size: 13px; letter-spacing: 0.05em; }
.work__meta { font-size: 11px; color: var(--ink-on-dark-soft); letter-spacing: 0.1em; margin-top: 4px; }
.work__pigments { display: flex; gap: 4px; margin-top: 8px; }
.work__pigments i { width: 9px; height: 9px; border-radius: 50%; display: block; }

/* ==========================================================================
   7. replay
   ========================================================================== */

.replay { align-items: center; justify-content: center; background: rgba(10, 7, 4, 0.94); }
.replay__inner { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; }
.replay__stage {
  box-shadow: var(--shadow-frame);
  background: var(--ground);
  max-width: 88vw;
}
.replay__stage canvas { display: block; max-width: 88vw; max-height: 66vh; width: auto; height: auto; }
.replay__controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.replay__time { font-size: 12px; letter-spacing: 0.12em; color: var(--ink-on-dark-soft); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   work detail
   ========================================================================== */

.detail { display: flex; gap: 30px; align-items: flex-start; }
.detail__art { flex: 0 0 auto; }
.detail__art img { display: block; max-width: min(52vw, 620px); max-height: 62vh; box-shadow: var(--shadow-frame); }
.detail__side { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 14px; }
.detail__ref { width: 132px; box-shadow: var(--shadow-soft); border: 4px solid #f3ede1; background: #f3ede1; }
.kv { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; border-bottom: 1px solid rgba(233, 223, 205, 0.10); padding-bottom: 7px; }
.kv span:first-child { color: var(--ink-on-dark-soft); }

/* ==========================================================================
   responsive
   ========================================================================== */

@media (max-width: 1120px) {
  .studio__palette { width: 320px; height: 212px; right: 18px; bottom: 66px; }
  .studio__tools { right: 352px; bottom: 34px; gap: 8px; }
  .studio__tubes { left: 150px; width: 260px; }
  .studio__stage { padding-right: 320px; }
  .edge--br { display: none; }
}

@media (max-width: 900px) {
  .prepare { flex-direction: column; padding: 0 20px 24px; gap: 18px; }
  .prepare__side { width: 100%; flex: 0 0 auto; }
  .studio__bench { height: 240px; }
  .studio__stage { bottom: 158px; padding: 14px 16px 10px; }
  .studio__palette { width: 250px; height: 166px; right: 10px; bottom: 84px; }
  .studio__tools {
    right: auto; left: 12px; bottom: 16px; gap: 6px;
  }
  .studio__tubes {
    left: auto; right: 10px; bottom: 262px; width: 180px;
    grid-template-columns: repeat(2, 1fr);
  }
  .tool { min-width: 56px; padding: 6px 5px 5px; }
  .tool__name { font-size: 9.5px; }
  .size-control { display: none; }
  .edge--bl { bottom: 210px; }
  .gallery__wall { padding: 20px 22px 120px; gap: 28px 22px; }
  .work { width: 45%; }
  .detail { flex-direction: column; }
}

@media (max-height: 720px) {
  .studio__bench { height: 158px; }
  .studio__palette { width: 330px; height: 218px; bottom: 60px; }
  .studio__tubes { bottom: 12px; }
  .studio__tools { bottom: 26px; }
}
