:root {
  --paper: #f3f6f3;
  --surface: #ffffff;
  --ink: #191815;
  --muted: #746d62;
  --line: #d8cfc0;
  --red: #3155f5;
  --green: #007a97;
  --copper: #ffc400;
  --ticket: #111713;
  --font-apple: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-family: var(--font-apple);
  font-weight: 300;
}
html[data-theme="dark"] {
  --paper: #0b1024;
  --surface: #141b35;
  --ink: #f3f7f4;
  --muted: #abb7af;
  --line: #34426f;
}
* {
  box-sizing: border-box;
}
h1, h2, h3, h4, h5, h6, b, strong {
  font-weight: 600;
}
html,
body {
  min-width: 320px;
  margin: 0;
}
html[data-theme="dark"] body {
  background:
    linear-gradient(rgba(11, 16, 36, 0.78), rgba(11, 16, 36, 0.93)),
    image-set(url("../assets/images/site05-scratch-orbit-v3.avif?v=s05-20261017-geo-v1") type("image/avif"), url("../assets/images/site05-scratch-orbit-v3.webp?v=s05-20261017-geo-v1") type("image/webp"), url("../assets/images/site05-scratch-orbit-v3.png?v=s05-20261017-geo-v1") type("image/png")) center/cover fixed,
    var(--paper);
  background-blend-mode: normal, luminosity, normal;
}
html[data-theme="dark"] .scratch-result { background: var(--surface); }
html[data-theme="dark"] .equation b,
html[data-theme="dark"] .labels b { background: #1d2921; }
button {
  font: inherit;
}
body {
  color: var(--ink);
  background:
    linear-gradient(rgba(237, 241, 255, 0.78), rgba(237, 241, 255, 0.94)),
    image-set(url("../assets/images/site05-scratch-orbit-v3.avif?v=s05-20261017-geo-v1") type("image/avif"), url("../assets/images/site05-scratch-orbit-v3.webp?v=s05-20261017-geo-v1") type("image/webp"), url("../assets/images/site05-scratch-orbit-v3.png?v=s05-20261017-geo-v1") type("image/png")) center/cover fixed,
    var(--paper);
  background-blend-mode: normal, luminosity, normal;
}
a {
  color: inherit;
  text-decoration: none;
}
.scratch-nav {
  width: min(1120px, calc(100% - 28px));
  min-height: 76px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.scratch-nav img {
  width: 168px;
  display: block;
}
.scratch-nav nav {
  display: flex;
  gap: 22px;
}
.scratch-nav nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.scratch-nav nav a[aria-current="page"] {
  color: var(--red);
}
.scratch-page {
  width: min(1120px, calc(100% - 28px));
  margin: auto;
}
.page-title {
  width: min(900px, 100%);
  margin-inline: auto;
  padding: 28px 0 18px;
}
.page-title h1 {
  margin: 0;
  font-size: 38px;
  letter-spacing: -0.05em;
}
.scratch-workspace {
  width: min(900px, 100%);
  margin-inline: auto;
}
.ticket {
  overflow: hidden;
  border-radius: 24px;
  background: var(--ticket);
  color: #fff;
  box-shadow: 0 24px 60px rgba(25, 24, 21, 0.22);
}
.ticket-head {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 22px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
}
.ticket-head > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ticket-head > div > span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--red);
  font-weight: 600;
}
.ticket-head p {
  display: grid;
  margin: 0;
  text-align: right;
}
.ticket-head > div p {
  text-align: left;
}
.ticket-head small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}
.ticket-body {
  padding: 20px;
}
.scratch-board {
  position: relative;
  min-height: 290px;
  overflow: hidden;
  border-radius: 17px;
  background: var(--paper);
}
.scratch-result,
.scratch-board canvas,
.scratch-loading {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.scratch-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.scratch-result > span {
  color: #9a6a2f;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
}
.equation {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.equation b,
.equation em {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-family: ui-monospace, monospace;
  font-size: 29px;
  font-style: normal;
}
.equation em {
  border: 0;
  background: var(--red);
  color: #fff;
}
.equation i {
  color: #996c35;
  font-style: normal;
  font-weight: 600;
}
.labels {
  margin-top: 14px;
  display: flex;
  gap: 7px;
}
.labels b {
  min-width: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  text-align: center;
}
.scratch-result > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.scratch-board canvas {
  z-index: 3;
  cursor: crosshair;
  touch-action: none;
  transition: opacity 0.35s ease;
}
.scratch-board canvas:focus-visible{outline:3px solid var(--copper);outline-offset:-6px}
.scratch-board canvas.is-revealed {
  pointer-events: none;
  opacity: 0;
}
.scratch-loading {
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #acb6b5, #e6e9e7 45%, #8d9b99);
  color: #25302e;
}
.scratch-loading[hidden] {
  display: none;
}
.scratch-loading i {
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
  border: 2px solid rgba(37, 48, 46, 0.2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.scratch-loading small {
  margin-top: 4px;
  color: #5c6865;
}
.progress-copy {
  margin-top: 15px;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}
.progress-copy b {
  color: var(--copper);
}
.progress {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}
.progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--copper));
}
.actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}
.actions button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.actions button:last-child {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}
.actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ticket-foot {
  min-height: 69px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}
.ticket-foot p {
  margin: 0;
}
.ticket-foot p:last-child {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ticket-foot strong {
  color: var(--copper);
  font-size: 16px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 560px) {
  .scratch-nav { width: min(100% - 20px, 1120px); }
  .scratch-nav img { width: 136px; }
  .scratch-nav nav { gap: 8px; }
  .scratch-nav nav a { gap: 4px; font-size: 11px; }
  .scratch-nav nav a .icon { width: 17px; height: 17px; }
  .page-title {
    padding: 22px 0 14px;
  }
  .page-title h1 {
    font-size: 30px;
  }
  .ticket {
    border-radius: 17px;
  }
  .ticket-head {
    padding: 13px;
  }
  .ticket-body {
    padding: 12px;
  }
  .scratch-board {
    min-height: 245px;
  }
  .equation {
    gap: 4px;
  }
  .equation b,
  .equation em {
    width: 46px;
    height: 46px;
    font-size: 21px;
  }
  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .actions button {
    padding: 0 7px;
  }
  .ticket-foot {
    padding: 12px 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
