.shelf-link, .text-button { min-height: 40px; padding: 5px 12px; color: inherit; background: transparent }
.shelf-link { gap: 8px; font: 500 14px/1.2 system-ui, sans-serif }
.ribbon { display: inline-block; flex: none; width: 9px; height: 13px; background: #a4b6a0; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%) }
#flip-label { position: relative; width: 44px; height: 44px; margin: -8px; padding: 0; background: transparent; color: var(--paper); perspective: 160px }
.label-faces { position: relative; width: 28px; height: 28px; transform-style: preserve-3d }
.label-faces .brand-mark { position: absolute; inset: 0; backface-visibility: hidden }
.label-faces .label-back {
  inset: -16px auto auto -5px; width: 38px; height: 60px; border-radius: 8px;
  background: #f5f3eb; transform: rotateY(180deg);
}
.label-back img { display: block; width: auto; height: 54px }
#flip-label[aria-pressed="true"] .label-faces { transform: rotateY(180deg) }
.text-button:hover, .shelf-link:hover { text-decoration: underline }
button:disabled { opacity: .45; cursor: default }
.code-area { display: flex; min-width: 0; flex: 1; margin: 20px 0 14px }
.code-area textarea, .gutter {
  margin: 0; font: 14px/1.95 var(--mono); tab-size: 4; padding: 0; border: 0; height: 180px;
}
.gutter { width: 42px; flex: none; overflow: hidden; color: #a5a6a2; padding-right: 12px; text-align: right; user-select: none }
#code { flex: 1; min-width: 0; resize: vertical; padding-right: 14px; color: #f4efea; background: transparent; cursor: text }
#code:focus-visible { outline: 1px solid #83817e; outline-offset: 1px }
#code.marked-line {
  background: linear-gradient(90deg, #aa6e7e 2px, #382b30 2px) 0 calc(var(--marked-line, 1) * 1.95em - var(--editor-scroll, 0px)) / 100% 1.95em no-repeat;
}
#language { color-scheme: dark; font: 13px var(--mono); background: #252628; color: #deded6; border: 1px solid #616260; border-radius: 5px; padding: 5px 8px }
#change { display: grid; gap: 5px }
#change del, #change ins { white-space: pre-wrap; overflow-wrap: anywhere }
.test-case { padding: 0 22px 10px; font-size: 13px }
summary { cursor: pointer; padding: 8px 0 }
summary span { color: #bebeb8; font-size: 12px; margin-left: 6px }
.test-case label { display: block; margin: 7px 0 3px }
.test-case textarea { display: block; width: 100%; resize: vertical; border: 1px solid #575759; border-radius: 4px; background: #222327; color: #f2efed; padding: 5px 8px; font: 14px/1.5 var(--mono) }
.actions { gap: 4px }
.actions #sample { margin-left: auto }
.values { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) }
dd, .error-output, .record pre { white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; max-height: 200px; cursor: text }
dd { font: 16px/1.5 var(--mono); letter-spacing: normal }
.error-output { font: 12px/1.6 var(--mono); color: #763946 }
.jump-line { min-height: 36px; padding: 4px 9px; color: #314b3d; background: #dae2d6; font-size: 13px }
.ear-line { position: relative }
.ear-line::after {
  content: ""; position: absolute; top: .06em; right: -9px; width: 10px; height: 8px;
  background: #b0c2ab; clip-path: polygon(0 0, 36% 27%, 63% 27%, 100% 0, 92% 77%, 74% 100%, 24% 100%, 6% 75%);
}
.workbench:is([data-state="loading"], [data-state="running"]) .cat-head { transform: rotate(9deg) }
.workbench:is([data-state="loading"], [data-state="running"]) .cat-eyes { opacity: 1 }
.workbench { margin-bottom: 14px }
#notice { margin-bottom: 32px; font-size: 13px; color: #d2d0c9 }
dialog { color-scheme: light; width: min(540px, 91vw); max-height: 80vh; border: 1px solid #81827d; border-radius: 8px; padding: 22px; background: var(--paper); color: var(--ink) }
dialog::backdrop { background: #141417aa }
.shelf-head { display: flex; align-items: center; justify-content: space-between }
.record { padding: 8px 0; border-bottom: 1px solid var(--rule) }
.record pre { font: 13px/1.6 var(--mono); background: #e2e1dc; padding: 12px }
.record summary { position: relative; overflow-wrap: anywhere }
.record summary small { display: block; margin: 4px 0 0 17px; color: var(--quiet); font-size: 12px }
.first-record summary { padding-right: 38px }
.cloth-tab {
  position: absolute; top: 11px; right: 0; width: 30px; height: 13px; border-radius: 2px 0 0 2px;
  background: repeating-linear-gradient(90deg, #ffffff15 0 1px, transparent 1px 3px), #91a88e;
  box-shadow: inset -2px 0 #748a72;
}
.cloth-tab::after { content: ""; position: absolute; inset: 4px 4px auto; border-top: 1px dashed #e7eadf }
.shelf-head { border-bottom: 1px solid var(--rule); padding-bottom: 9px; margin-bottom: 12px }
.shelf-head h2 {
  display: flex; align-items: center; gap: 11px; margin: 0;
  font: 500 27px/1.2 system-ui, sans-serif; letter-spacing: -.035em;
}
.shelf-head .ribbon { width: 12px; height: 18px; background: #849b81 }
.shelf-head .text-button { min-height: 44px; padding: 4px 8px; color: #5b5d58; font: 500 13px/1.3 system-ui, sans-serif }
/* 让输出区和收藏夹共用一道纸边。 */
.output, #shelf { box-shadow: inset -3px 0 #dcdcd4, inset -4px 0 #f6f5ed }
@media (prefers-reduced-motion: no-preference) {
  .label-faces { transition: transform 360ms ease-in-out }
  .pet-cat.stretching .cat-back { animation: wake-back 1.5s ease-in-out }
  .pet-cat.stretching .cat-paw { animation: wake-paw 1.5s ease-in-out }
  .pet-cat.stretching .cat-head { animation: wake-head 1.5s ease-in-out }
  @keyframes wake-back { 45%, 60% { transform: scale(.97, 1.45) } }
  @keyframes wake-paw { 45%, 60% { transform: translateX(-10px) scaleX(1.2) } }
  @keyframes wake-head { 45%, 60% { transform: translateX(-3px) rotate(-5deg) } }
}
#records { margin-block: 12px }
@media(max-width: 740px) {
  .gutter { width: 30px; padding-right: 8px }
  .code-area textarea, .gutter { height: 150px; font-size: 13px }
  .test-case { padding-inline: 14px }
  .actions { flex-wrap: wrap }
  .shelf-link, .text-button { min-height: 44px }
}
