:root {
  color-scheme: dark;
  --ink: #171b18;
  --paper: #f3eedf;
  --paper-bright: #fffaf0;
  --machine: #25352f;
  --machine-dark: #111915;
  --machine-edge: #486157;
  --accent: #ee694c;
  --accent-bright: #ff8a67;
  --signal: #7bd8bc;
  --muted: #9ba9a2;
  --panel: #171d19;
  --panel-border: #35433c;
  --shadow: rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #0d110f;
  color: #f4f1e8;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.studio-canvas {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(238, 105, 76, 0.08), transparent 30%),
    repeating-linear-gradient(90deg, transparent 0 95px, rgba(255, 255, 255, 0.025) 95px 96px),
    radial-gradient(circle at 75% 20%, #26332c 0, #111613 42%, #090c0a 100%);
}

.studio-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.05) 3px 4px);
  pointer-events: none;
}

.live-stage {
  position: relative;
  perspective: 1800px;
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  margin: auto;
  top: 50%;
  transform: translateY(-50%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 18%),
    #17201c;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.72);
  overflow: hidden;
  isolation: isolate;
}

.live-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(238, 105, 76, 0.06), transparent 16%, transparent 84%, rgba(123, 216, 188, 0.045)),
    repeating-linear-gradient(0deg, transparent 0 5.9%, rgba(255, 255, 255, 0.025) 6%, transparent 6.1%);
}

.plotter-shell {
  position: absolute;
  inset: 3.4% 5.2% 4.1%;
  overflow: visible;
  border: 1px solid var(--machine-edge);
  border-radius: 9px;
  background:
    linear-gradient(108deg, rgba(255, 255, 255, 0.08), transparent 13%, transparent 76%, rgba(0, 0, 0, 0.2)),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(255, 255, 255, 0.016) 23px 24px),
    linear-gradient(180deg, #3b5147 0, #2a3e35 19%, #1c2b24 100%);
  box-shadow:
    0 52px 95px rgba(0, 0, 0, 0.52),
    0 14px 24px rgba(0, 0, 0, 0.38),
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -22px 45px rgba(0, 0, 0, 0.3),
    inset 2px 0 0 rgba(255, 255, 255, 0.05);
  transform-style: preserve-3d;
  isolation: isolate;
}

.chassis-top-edge {
  position: absolute;
  z-index: 2;
  top: -9px;
  left: 2.2%;
  right: -15px;
  height: 11px;
  border: 1px solid #687a71;
  border-bottom: 0;
  border-radius: 7px 9px 0 0;
  background:
    linear-gradient(180deg, #7b8b83, #46574f 52%, #28362f 54%, #1c2822);
  transform: skewX(-13deg);
  box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.chassis-depth {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.chassis-depth-right {
  top: 8px;
  right: -16px;
  bottom: -17px;
  width: 17px;
  border: 1px solid #101713;
  border-left: 0;
  border-radius: 0 8px 9px 0;
  background:
    linear-gradient(90deg, #17211c, #0a0f0c 58%, #050807);
  box-shadow: 7px 9px 16px rgba(0, 0, 0, 0.44);
  transform: skewY(2.4deg);
  transform-origin: top right;
}

.chassis-depth-bottom {
  left: 9px;
  right: -16px;
  bottom: -17px;
  height: 18px;
  border: 1px solid #0b100d;
  border-top: 0;
  border-radius: 0 0 9px 9px;
  background:
    linear-gradient(180deg, #17231d 0, #0c1410 58%, #050806 100%);
  box-shadow: 9px 10px 17px rgba(0, 0, 0, 0.48);
  transform: skewX(-39deg);
  transform-origin: bottom left;
}

.plotter-shell::before,
.plotter-shell::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #6d8078;
  border-radius: 50%;
  z-index: 4;
  top: 2.2%;
  background: #111815;
  box-shadow: inset 0 2px 3px #000;
}

.plotter-shell::before {
  left: 2.2%;
}

.plotter-shell::after {
  right: 2.2%;
}

.machine-brand {
  position: relative;
  z-index: 3;
  height: 7.3%;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 3.8%;
  border-bottom: 1px solid rgba(0, 0, 0, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 45%, rgba(0, 0, 0, 0.12));
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 4px;
  background: var(--accent);
  color: #161b18;
  font-family: Consolas, monospace;
  font-size: 17px;
  font-weight: 900;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}

.brand-name {
  color: #e6ece7;
  font-family: Consolas, monospace;
  font-size: clamp(10px, 1.1vw, 17px);
  font-weight: 700;
  letter-spacing: 0.16em;
}

.model-label {
  margin-left: 7px;
  padding-left: 17px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  color: #788b82;
  font: 9px/1 Consolas, monospace;
  letter-spacing: 0.12em;
}

.machine-state {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid rgba(123, 216, 188, 0.38);
  border-radius: 999px;
  color: var(--signal);
  font-size: clamp(9px, 0.8vw, 13px);
  letter-spacing: 0.08em;
}

.machine-state.is-busy {
  color: var(--accent-bright);
  border-color: rgba(238, 105, 76, 0.48);
  animation: statePulse 0.8s ease-in-out infinite alternate;
}

@keyframes statePulse {
  to { opacity: 0.55; }
}

.machine-meters {
  position: relative;
  z-index: 3;
  height: 8.2%;
  display: grid;
  grid-template-columns: 1fr 1fr 2.3fr;
  align-items: center;
  padding: 0 4.4%;
  border-bottom: 1px solid rgba(0, 0, 0, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 45%),
    #17231d;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.12);
}

.meter-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.meter-label {
  color: #75877f;
  font-family: Consolas, monospace;
  font-size: clamp(8px, 0.65vw, 11px);
  letter-spacing: 0.1em;
}

.meter-block strong {
  color: #dce5df;
  font-family: Consolas, monospace;
  font-size: clamp(16px, 1.6vw, 26px);
  font-weight: 400;
}

.signal-block {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #91a29a;
  font-size: clamp(9px, 0.78vw, 13px);
}

.signal-dot,
.connection-light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #7f8d87;
  box-shadow: 0 0 0 4px rgba(127, 141, 135, 0.08);
}

.signal-dot.is-online,
.connection-light.is-online {
  background: var(--signal);
  box-shadow: 0 0 0 4px rgba(123, 216, 188, 0.1), 0 0 15px rgba(123, 216, 188, 0.62);
}

.signal-dot.is-offline,
.connection-light.is-offline {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(238, 105, 76, 0.1);
}

.plotter-rail {
  position: absolute;
  z-index: 20;
  left: 3.2%;
  right: 3.2%;
  top: 16.2%;
  height: 8%;
  min-height: 52px;
  transform: translateZ(28px);
  filter: drop-shadow(0 14px 12px rgba(0, 0, 0, 0.3));
}

.rail-groove {
  position: absolute;
  left: 1.5%;
  right: 1.5%;
  top: 12px;
  height: 27px;
  border: 1px solid #0c120f;
  border-radius: 5px;
  background:
    linear-gradient(180deg, #96a39c 0, #53635b 18%, #1a2420 23%, #0a0f0c 42%, #303c36 45%, #131b17 100%);
  box-shadow:
    0 4px 0 #080c0a,
    0 7px 0 #425149,
    0 10px 0 #111914,
    0 19px 27px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.rail-highlight {
  position: absolute;
  z-index: 4;
  left: 4%;
  right: 4%;
  top: 13px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42) 18%, rgba(255, 255, 255, 0.12) 80%, transparent);
}

.rail-endcap {
  position: absolute;
  z-index: 3;
  top: 0;
  width: clamp(32px, 4.5%, 54px);
  height: 52px;
  border: 1px solid #65776e;
  border-radius: 6px;
  background:
    linear-gradient(90deg, #1a2620, #4a5b52 20%, #26352e 62%, #0b100d),
    #25342c;
  box-shadow:
    0 7px 0 #0a0f0c,
    0 12px 18px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.rail-endcap::before {
  content: "";
  position: absolute;
  inset: 9px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  background:
    radial-gradient(circle at 50% 30%, #0f1512 0 2px, transparent 3px),
    radial-gradient(circle at 50% 70%, #0f1512 0 2px, transparent 3px),
    linear-gradient(180deg, #28372f, #17211c);
}

.rail-endcap-left {
  left: -1.8%;
}

.rail-endcap-right {
  right: -1.8%;
}

.carriage {
  position: absolute;
  z-index: 22;
  top: -5px;
  left: 2.5%;
  width: clamp(68px, 8.5vw, 116px);
  height: 94px;
  transform: translateX(0);
  will-change: transform;
  filter: drop-shadow(8px 13px 9px rgba(0, 0, 0, 0.42));
}

.carriage-top {
  position: relative;
  z-index: 3;
  width: 72%;
  height: 17px;
  margin: 0 auto -2px;
  border: 1px solid #839089;
  background: linear-gradient(180deg, #87958d, #43534b 42%, #202b26 45%, #111814);
  border-radius: 5px 5px 1px 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.carriage-body {
  position: relative;
  height: 52px;
  border: 1px solid #78877f;
  border-radius: 6px;
  background:
    linear-gradient(90deg, #111713 0, #45554d 11%, #26352e 46%, #36473f 72%, #0c120f 100%);
  box-shadow:
    6px 7px 0 #0b100d,
    8px 10px 0 #25332c,
    12px 16px 20px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -8px 13px rgba(0, 0, 0, 0.25);
}

.carriage-body::before {
  content: "";
  position: absolute;
  inset: 7px 13px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, transparent 0 10px, rgba(0, 0, 0, 0.14) 10px 11px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.08));
}

.carriage-body::after {
  content: "";
  position: absolute;
  left: 11px;
  bottom: 9px;
  width: 20px;
  height: 4px;
  background: repeating-linear-gradient(90deg, #0b100d 0 2px, #34413b 2px 4px);
  opacity: 0.65;
}

.carriage-light {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  z-index: 2;
  top: 10px;
  right: 12px;
  background: var(--signal);
  box-shadow: 0 0 10px rgba(123, 216, 188, 0.72);
}

.pen-mount {
  position: absolute;
  left: 50%;
  z-index: 3;
  bottom: -18px;
  width: 31px;
  height: 27px;
  transform: translateX(-50%);
  clip-path: polygon(16% 0, 84% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(90deg, #101713, #596a61 22%, #26332d 50%, #4a5a52 76%, #0b100d);
  filter: drop-shadow(3px 7px 4px rgba(0, 0, 0, 0.38));
}

.pen-tip {
  position: absolute;
  left: 50%;
  top: 65px;
  width: 8px;
  height: 31px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #66716c, #f4f7f3 36%, #e2e7e2 55%, #59645f);
  clip-path: polygon(20% 0, 80% 0, 50% 100%);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.42));
}

.carriage.is-working .pen-mount,
.carriage.is-working .pen-tip {
  filter: drop-shadow(0 0 8px rgba(123, 216, 188, 0.8));
}

.paper-frame {
  position: absolute;
  left: 7.2%;
  right: 7.2%;
  top: 21.2%;
  bottom: 10.3%;
  z-index: 10;
  padding-left: 2.6%;
  perspective: 1050px;
  transform-style: preserve-3d;
  filter: drop-shadow(8px 22px 22px rgba(0, 0, 0, 0.28));
}

.feed-head {
  position: absolute;
  z-index: 30;
  left: 1.5%;
  right: -1.4%;
  top: -1.8%;
  height: 4.3%;
  min-height: 24px;
  border: 1px solid #65766d;
  border-radius: 5px;
  background:
    linear-gradient(180deg, #56665e 0, #2b3a33 23%, #15201b 28%, #293932 53%, #111914 100%);
  box-shadow:
    0 5px 0 #0b100d,
    0 10px 0 #35443d,
    0 15px 22px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: translateZ(36px);
}

.feed-slot {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 43%;
  height: 26%;
  border: 1px solid #050806;
  border-radius: 2px;
  background:
    linear-gradient(180deg, #030504, #0a0e0b 42%, #253029 48%, #090c0a);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.66), inset 0 2px 5px #000;
}

.feed-wheel {
  position: absolute;
  z-index: 3;
  top: -24%;
  width: clamp(18px, 2.4vw, 29px);
  aspect-ratio: 1;
  border: 1px solid #6d7c74;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, #18211c 0 10deg, #47564e 10deg 20deg);
  box-shadow:
    0 4px 0 #0a0f0c,
    0 8px 11px rgba(0, 0, 0, 0.38),
    inset 0 0 0 4px #1e2a23;
}

.feed-wheel::after {
  content: "";
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: #79877f;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.feed-wheel-left {
  left: 11%;
}

.feed-wheel-right {
  right: 11%;
}

.feed-head-led {
  position: absolute;
  right: 3.4%;
  top: 18%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 11px rgba(123, 216, 188, 0.85);
}

.paper-side-guide {
  position: absolute;
  z-index: 26;
  top: 2.3%;
  bottom: -0.8%;
  width: clamp(5px, 0.65vw, 9px);
  border: 1px solid #53665c;
  border-radius: 4px;
  background:
    linear-gradient(90deg, #111713, #4e6057 28%, #1b2821 68%, #080c09);
  box-shadow:
    4px 5px 0 #080d0a,
    7px 10px 13px rgba(0, 0, 0, 0.42);
}

.paper-side-guide-left {
  left: 1.1%;
}

.paper-side-guide-right {
  right: -1.1%;
}

.paper-frame.is-advancing .feed-wheel {
  animation: rollerSpin 0.48s linear infinite;
}

@keyframes rollerSpin {
  to { transform: rotate(360deg); }
}

.paper-ruler {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2.3%;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  color: #75857e;
  font: 9px/1 Consolas, monospace;
  background: #1b2721;
  border: 1px solid #394840;
  border-right: 0;
}

.paper-ruler span {
  font-size: 0;
}

.paper-ruler span::after {
  content: "";
  display: block;
  width: 8px;
  height: 1px;
  background: #596a62;
  margin: 9px auto 0;
}

.paper-window {
  position: relative;
  container-type: inline-size;
  width: 100%;
  height: 100%;
  padding: 3.7% 3.4% 3.2%;
  overflow: hidden;
  border-radius: 1px 1px 4px 4px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 2%, transparent 97%, rgba(0, 0, 0, 0.2)),
    linear-gradient(180deg, rgba(61, 48, 31, 0.12), transparent 5%),
    var(--paper);
  box-shadow:
    0 35px 50px rgba(0, 0, 0, 0.46),
    0 8px 16px rgba(0, 0, 0, 0.24),
    inset 0 0 52px rgba(105, 88, 56, 0.13),
    0 0 0 1px rgba(255, 255, 255, 0.42);
  transform: rotateX(2.2deg) translateZ(10px);
  transform-origin: top center;
}

.paper-window::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  box-shadow:
    inset 0 26px 34px rgba(63, 50, 33, 0.15),
    inset 0 -18px 24px rgba(62, 49, 30, 0.08);
}

.paper-window::after {
  content: "";
  position: absolute;
  z-index: 6;
  left: 1.8%;
  right: 1.8%;
  bottom: -9px;
  height: 18px;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(180deg, #e8e1d1, #f8f3e7 55%, #c9c0ad);
  box-shadow: 0 8px 11px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.paper-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  background-image:
    repeating-radial-gradient(circle at 13% 28%, rgba(60, 49, 30, 0.05) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(65, 57, 45, 0.025) 31px 32px);
}

.paper-advance-shine {
  position: absolute;
  z-index: 5;
  top: -30%;
  left: 0;
  right: 0;
  height: 32%;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.32) 42%, rgba(91, 76, 50, 0.06) 72%, transparent);
}

.paper-window.is-advancing {
  animation: paperAdvance 1.12s cubic-bezier(0.2, 0.74, 0.2, 1);
}

.paper-window.is-advancing .paper-advance-shine {
  animation: paperShine 1.05s linear;
}

.paper-window.is-advancing .paper-grain {
  animation: paperGrainMove 1.05s linear;
}

.paper-window.is-advancing .paper-edge {
  animation: paperEdgeMove 1.05s linear;
}

@keyframes paperAdvance {
  0% { transform: rotateX(2.2deg) translateY(0) translateZ(10px); }
  28% { transform: rotateX(2.2deg) translateY(5px) translateZ(10px); }
  62% { transform: rotateX(2.2deg) translateY(2px) translateZ(10px); }
  100% { transform: rotateX(2.2deg) translateY(0) translateZ(10px); }
}

@keyframes paperShine {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: 0.9; }
  90% { opacity: 0.34; }
  100% { opacity: 0; transform: translateY(450%); }
}

@keyframes paperGrainMove {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 42px, 0 128px; }
}

@keyframes paperEdgeMove {
  from { background-position: 0 0; }
  to { background-position: 0 84px; }
}

.paper-edge {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: 6px;
  background: repeating-linear-gradient(180deg, #ddd3bd 0 7px, #f7f0df 7px 14px);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.18);
}

.paper-edge-left {
  left: 0;
  clip-path: polygon(0 0, 100% 0, 30% 2%, 100% 4%, 20% 6%, 100% 8%, 25% 10%, 100% 12%, 20% 14%, 100% 16%, 20% 18%, 100% 20%, 30% 22%, 100% 24%, 20% 26%, 100% 28%, 30% 30%, 100% 32%, 20% 34%, 100% 36%, 25% 38%, 100% 40%, 20% 42%, 100% 44%, 30% 46%, 100% 48%, 20% 50%, 100% 52%, 25% 54%, 100% 56%, 20% 58%, 100% 60%, 30% 62%, 100% 64%, 20% 66%, 100% 68%, 25% 70%, 100% 72%, 20% 74%, 100% 76%, 30% 78%, 100% 80%, 20% 82%, 100% 84%, 25% 86%, 100% 88%, 20% 90%, 100% 92%, 30% 94%, 100% 96%, 20% 98%, 100% 100%, 0 100%);
}

.paper-edge-right {
  right: 0;
  transform: scaleX(-1);
  clip-path: polygon(0 0, 100% 0, 30% 2%, 100% 4%, 20% 6%, 100% 8%, 25% 10%, 100% 12%, 20% 14%, 100% 16%, 20% 18%, 100% 20%, 30% 22%, 100% 24%, 20% 26%, 100% 28%, 30% 30%, 100% 32%, 20% 34%, 100% 36%, 25% 38%, 100% 40%, 20% 42%, 100% 44%, 30% 46%, 100% 48%, 20% 50%, 100% 52%, 25% 54%, 100% 56%, 20% 58%, 100% 60%, 30% 62%, 100% 64%, 20% 66%, 100% 68%, 25% 70%, 100% 72%, 20% 74%, 100% 76%, 30% 78%, 100% 80%, 20% 82%, 100% 84%, 25% 86%, 100% 88%, 20% 90%, 100% 92%, 30% 94%, 100% 96%, 20% 98%, 100% 100%, 0 100%);
}

.paper-feed {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2.1%;
  height: 100%;
}

.empty-paper {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  color: #8b8679;
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(13px, 1.4vw, 24px);
  letter-spacing: 0.28em;
  transition: opacity 0.25s ease;
}

.empty-paper.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.empty-line {
  width: 22%;
  height: 1px;
  background: #b9b09d;
}

.print-card {
  position: relative;
  flex: 0 0 29.5%;
  max-height: 29.5%;
  min-height: 0;
  padding: 1.8% 2.2% 1.2%;
  color: var(--ink);
  border: 1px solid rgba(54, 58, 47, 0.26);
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(226, 216, 192, 0.2), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 22%),
    var(--paper-bright);
  box-shadow:
    0 5px 12px rgba(53, 45, 30, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  overflow: hidden;
  transform-origin: top center;
  transition:
    flex-basis 1.02s cubic-bezier(0.18, 0.72, 0.2, 1),
    max-height 1.02s cubic-bezier(0.18, 0.72, 0.2, 1),
    opacity 0.34s ease,
    transform 1.02s cubic-bezier(0.18, 0.72, 0.2, 1),
    box-shadow 0.35s ease;
}

.print-card.is-feeding {
  flex-basis: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  opacity: 0;
  transform: translateY(-14%);
  box-shadow: none;
}

.card-index {
  position: absolute;
  right: 2%;
  top: 3.6%;
  color: #a39b8a;
  font: clamp(7px, 0.62vw, 11px)/1 Consolas, monospace;
  letter-spacing: 0.08em;
}

.print-surface {
  position: relative;
  display: grid;
  grid-template-columns: 28% 1fr;
  gap: 4.8%;
  height: 84%;
  align-items: center;
  padding: 0 4.6%;
}

.print-card.is-printing .print-surface {
  clip-path: inset(0 100% 0 0);
  animation: printSweep 2.2s linear forwards;
}

@keyframes printSweep {
  to { clip-path: inset(0 0 0 0); }
}

.portrait-wrap {
  position: relative;
  aspect-ratio: 1;
  align-self: center;
  border: 1px solid #3f463e;
  background: #e6dfcf;
  overflow: hidden;
}

.portrait-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.3;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(45, 52, 45, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 52, 45, 0.18) 1px, transparent 1px);
  background-size: 12.5% 12.5%;
}

.portrait-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.75) contrast(1.08) sepia(0.06);
}

.portrait-fallback {
  position: absolute;
  inset: 0;
}

.portrait-fallback::before {
  content: "";
  position: absolute;
  top: 25%;
  left: 50%;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #5f675d;
  transform: translateX(-50%);
}

.portrait-fallback::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 16%;
  width: 50%;
  height: 24%;
  border-radius: 50% 50% 5% 5%;
  background: #5f675d;
  transform: translateX(-50%);
}

.portrait-corners::before,
.portrait-corners::after {
  content: "";
  position: absolute;
  z-index: 3;
  width: 14%;
  height: 14%;
  border-color: var(--accent);
  border-style: solid;
}

.portrait-corners::before {
  top: 4%;
  left: 4%;
  border-width: 2px 0 0 2px;
}

.portrait-corners::after {
  right: 4%;
  bottom: 4%;
  border-width: 0 2px 2px 0;
}

.card-copy {
  min-width: 0;
}

.event-type-label {
  display: inline-block;
  margin-bottom: 1.6%;
  color: #b74d37;
  font: 700 clamp(7px, 1.55cqw, 13px)/1.2 Consolas, "Microsoft YaHei", sans-serif;
  letter-spacing: 0.12em;
}

.visitor-name {
  max-width: 100%;
  margin: 0;
  color: #161c18;
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(18px, 6cqw, 50px);
  line-height: 1.08;
  font-weight: 700;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}

.visitor-name.is-long-name {
  font-size: clamp(16px, 4.8cqw, 42px);
}

.visitor-name.is-very-long-name {
  font-size: clamp(14px, 4cqw, 35px);
}

.event-detail {
  margin: 2.8% 0 0;
  color: #68685e;
  font-size: clamp(8px, 2cqw, 17px);
  line-height: 1.45;
}

.ink-stamp {
  position: absolute;
  right: 7%;
  bottom: 2%;
  width: clamp(46px, 13cqw, 108px);
  aspect-ratio: 1.45;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(180, 59, 38, 0.82);
  border-radius: 50%;
  color: rgba(180, 59, 38, 0.86);
  transform: rotate(-10deg) scale(2.2);
  opacity: 0;
  mix-blend-mode: multiply;
}

.ink-stamp::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.ink-stamp.is-active {
  animation: stampHit 0.3s cubic-bezier(0.18, 0.88, 0.28, 1.32) forwards;
}

@keyframes stampHit {
  to {
    opacity: 1;
    transform: rotate(-10deg) scale(1);
  }
}

.stamp-main {
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(14px, 4cqw, 31px);
  font-weight: 900;
  line-height: 1;
}

.stamp-sub {
  margin-top: 3px;
  font: 700 clamp(6px, 1.2cqw, 10px)/1 Consolas, monospace;
  letter-spacing: 0.15em;
}

.card-footer {
  position: absolute;
  left: 7%;
  right: 3%;
  bottom: 3.7%;
  display: flex;
  align-items: center;
  gap: 2.2%;
  color: #918a7a;
  font: clamp(6px, 1.15cqw, 10px)/1 Consolas, monospace;
  letter-spacing: 0.05em;
}

.card-footer .barcode {
  flex: 1;
  height: 8px;
  background: repeating-linear-gradient(90deg, #494f47 0 2px, transparent 2px 5px, #494f47 5px 6px, transparent 6px 10px);
}

.machine-footer {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 2.3%;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #71827a;
  font: clamp(8px, 0.75vw, 12px)/1 Consolas, monospace;
  letter-spacing: 0.12em;
}

.footer-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, #46564e, transparent);
}

.panel-toggle {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border: 1px solid #49574f;
  border-radius: 5px;
  background: rgba(20, 26, 22, 0.94);
  color: #dce6df;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.panel-toggle:hover {
  border-color: var(--signal);
}

.panel-toggle.is-hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.toggle-lines {
  width: 14px;
  height: 10px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.control-panel {
  position: fixed;
  z-index: 70;
  top: 0;
  right: 0;
  width: min(390px, calc(100vw - 18px));
  height: 100%;
  padding: 26px 24px 22px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 24%),
    var(--panel);
  border-left: 1px solid var(--panel-border);
  box-shadow: -24px 0 54px rgba(0, 0, 0, 0.38);
  transition: transform 0.34s cubic-bezier(0.22, 0.72, 0.2, 1), opacity 0.24s ease;
}

.control-panel.is-hidden {
  transform: translateX(104%);
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.panel-kicker {
  color: var(--accent);
  font: 700 10px/1 Consolas, monospace;
  letter-spacing: 0.18em;
}

.panel-header h1 {
  margin: 7px 0 0;
  color: #f1f3ee;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 700;
}

.close-panel {
  width: 34px;
  height: 34px;
  border: 1px solid #3c4b43;
  border-radius: 4px;
  background: #1c241f;
  color: #a8b4ad;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.close-panel:hover {
  color: #fff;
  border-color: #64776d;
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  margin-bottom: 22px;
  border: 1px solid #334139;
  border-radius: 5px;
  background: #121814;
}

.connection-card div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.connection-card strong {
  color: #dce3de;
  font-size: 13px;
  font-weight: 600;
}

.connection-card span:last-child {
  color: #78877f;
  font-size: 11px;
}

.speed-control {
  display: grid;
  gap: 9px;
  padding: 14px;
  margin-bottom: 20px;
  border: 1px solid #334139;
  border-radius: 5px;
  background: #121814;
}

.speed-header,
.speed-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.speed-header label {
  color: #a5b0aa;
  font-size: 12px;
}

.speed-header output {
  color: var(--signal);
  font: 700 17px/1 Consolas, monospace;
}

.speed-control input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.speed-meta {
  color: #697870;
  font: 10px/1 Consolas, monospace;
}

.speed-meta span:nth-child(2) {
  color: #aab7b0;
}

.sound-control {
  display: grid;
  gap: 9px;
  padding: 13px 14px;
  margin-bottom: 20px;
  border: 1px solid #334139;
  border-radius: 5px;
  background: #121814;
}

.sound-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sound-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #a5b0aa;
  font-size: 12px;
  cursor: pointer;
}

.sound-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--signal);
}

.sound-header output {
  color: #9fb0a7;
  font: 700 12px/1 Consolas, monospace;
}

.sound-preview {
  height: 26px;
  padding: 0 9px;
  border: 1px solid #405149;
  border-radius: 4px;
  background: #1a231e;
  color: #b8c4bd;
  font-size: 10px;
  cursor: pointer;
}

.sound-preview:hover {
  border-color: var(--signal);
  color: #edf4ef;
}

.sound-preview:disabled {
  opacity: 0.4;
  cursor: default;
}

.sound-control input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--signal);
  cursor: pointer;
}

.sound-status {
  color: #72827a;
  font: 10px/1.2 Consolas, monospace;
}

.test-form {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-group label,
.type-selector legend {
  color: #a5b0aa;
  font-size: 12px;
}

.field-group input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #394840;
  border-radius: 4px;
  outline: none;
  background: #101511;
  color: #eef1ed;
  font-size: 13px;
}

.field-group input:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 3px rgba(123, 216, 188, 0.07);
}

.avatar-preview-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.avatar-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  overflow: hidden;
  border: 1px solid #46564d;
  border-radius: 50%;
  background: #e6dfcf;
  color: #77776f;
  font-size: 8px;
}

.avatar-preview.is-empty::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #8a887f;
  transform: translateX(-50%);
}

.avatar-preview.is-empty::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 23px;
  height: 13px;
  border-radius: 50% 50% 4px 4px;
  background: #8a887f;
  transform: translateX(-50%);
}

.avatar-preview img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.type-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
}

.type-selector legend {
  margin-bottom: 7px;
}

.type-selector label {
  position: relative;
}

.type-selector input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-selector span {
  display: grid;
  place-items: center;
  height: 40px;
  border: 1px solid #394840;
  border-radius: 4px;
  background: #111712;
  color: #89978f;
  font-size: 13px;
  cursor: pointer;
}

.type-selector input:checked + span {
  border-color: var(--accent);
  background: rgba(238, 105, 76, 0.1);
  color: #ffb19e;
}

.gift-fields {
  display: grid;
  grid-template-columns: 1fr 95px;
  gap: 9px;
}

.gift-fields.is-hidden {
  display: none;
}

.print-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  margin-top: 3px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #151a17;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.print-button:hover {
  background: var(--accent-bright);
}

.print-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.button-arrow {
  font-size: 21px;
  font-weight: 400;
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
}

.secondary-button {
  height: 39px;
  border: 1px solid #3a4941;
  border-radius: 4px;
  background: #202923;
  color: #aebbb4;
  font-size: 12px;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: #61756a;
  color: #edf2ee;
}

.event-log-head {
  display: flex;
  justify-content: space-between;
  margin: 27px 0 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid #303c35;
  color: #9eaaa3;
  font-size: 12px;
}

.event-log {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-log li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid #2d3932;
  border-radius: 4px;
  background: #131915;
}

.log-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 50%;
  background: #dad2c1;
  color: #3d433d;
  font-size: 13px;
  font-weight: 700;
}

.log-avatar::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #6d7169;
  transform: translateX(-50%);
}

.log-avatar::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 19px;
  height: 11px;
  border-radius: 50% 50% 4px 4px;
  background: #6d7169;
  transform: translateX(-50%);
}

.log-avatar img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.log-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.log-copy strong {
  overflow: hidden;
  color: #dce2de;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-copy span,
.log-time {
  color: #6d7b73;
  font-size: 10px;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 28px;
  max-width: min(480px, calc(100vw - 32px));
  padding: 11px 16px;
  border: 1px solid #43544b;
  border-radius: 5px;
  background: rgba(19, 25, 21, 0.96);
  color: #edf2ee;
  font-size: 12px;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.42);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.writer-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #4b2918;
}

.writer-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.scene-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(16, 7, 3, 0.55), transparent 16%, transparent 77%, rgba(17, 8, 4, 0.48)),
    radial-gradient(ellipse at center, transparent 44%, rgba(17, 7, 2, 0.3) 100%);
  mix-blend-mode: multiply;
}

.scene-hud {
  position: absolute;
  z-index: 5;
  top: 3.2%;
  left: 5%;
  right: 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.writer-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #f7f1e5;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.writer-monogram {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 5px;
  background: #1556c5;
  color: #fff;
  font: 900 29px/1 "Microsoft YaHei", sans-serif;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.writer-wordmark {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.writer-wordmark strong {
  font: 700 clamp(10px, 1.25vw, 18px)/1 Consolas, monospace;
  letter-spacing: 0.08em;
}

.writer-wordmark small {
  color: rgba(255, 244, 228, 0.7);
  font: 8px/1 Consolas, monospace;
  letter-spacing: 0.12em;
}

.writer-state {
  padding: 7px 13px;
  border: 1px solid rgba(151, 220, 255, 0.42);
  border-radius: 999px;
  background: rgba(8, 18, 30, 0.38);
  color: #9edfff;
  font-size: clamp(9px, 0.82vw, 13px);
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
}

.writer-state.is-busy {
  color: #ffd2b8;
  border-color: rgba(255, 150, 94, 0.55);
  animation: statePulse 0.72s ease-in-out infinite alternate;
}

.scene-readout {
  position: absolute;
  z-index: 5;
  left: 5%;
  bottom: 3.4%;
  display: flex;
  align-items: flex-end;
  gap: clamp(16px, 2.8vw, 38px);
  color: #f3e9da;
  pointer-events: none;
  text-shadow: 0 2px 9px rgba(0, 0, 0, 0.48);
}

.scene-readout > div:not(.scene-signal) {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scene-readout span {
  color: rgba(255, 241, 220, 0.62);
  font: 8px/1 Consolas, monospace;
  letter-spacing: 0.12em;
}

.scene-readout strong {
  font: 400 clamp(16px, 1.5vw, 23px)/1 Consolas, monospace;
}

.scene-signal {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 1px;
}

.scene-clock {
  position: absolute;
  z-index: 5;
  right: 5%;
  bottom: 3.4%;
  color: rgba(255, 241, 220, 0.65);
  font: 9px/1 Consolas, monospace;
  letter-spacing: 0.1em;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

body.obs-mode {
  background: transparent;
}

body.obs-mode .studio-canvas,
body.obs-mode .control-panel,
body.obs-mode .panel-toggle,
body.obs-mode .toast {
  display: none;
}

body.obs-mode .live-stage {
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  top: 50%;
  transform: translateY(-50%);
  background: #4b2918;
  box-shadow: none;
}

body.obs-mode .live-stage::before {
  display: none;
}

body.obs-mode .plotter-shell {
  inset: 3% 5%;
}

body.obs-mode .plotter-rail {
  top: 16.2%;
}

body.obs-mode .paper-frame {
  top: 21.2%;
  bottom: 10.3%;
}

body.obs-mode .paper-window {
  box-shadow:
    0 35px 50px rgba(0, 0, 0, 0.46),
    0 8px 16px rgba(0, 0, 0, 0.24),
    inset 0 0 52px rgba(105, 88, 56, 0.13),
    0 0 0 1px rgba(255, 255, 255, 0.42);
}

@media (max-width: 760px) {
  .control-panel {
    width: 100%;
    max-width: 100%;
    padding: 22px 18px;
  }

  .panel-toggle {
    right: 15px;
    bottom: 15px;
  }

  .machine-meters {
    grid-template-columns: 1fr 1fr 1.4fr;
  }
}

@media (max-height: 680px) {
  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .plotter-rail {
    min-height: 38px;
  }

  .carriage {
    transform: scale(0.82);
    transform-origin: center bottom;
  }
}

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