/* /public/css/common.css */

[data-scheme="green"]{
  --color-bg-1:      var(--color-green-1);
  --color-muted-1:   var(--color-green-2);
}
[data-scheme="brown"]{
  --color-bg-1:      var(--color-brown-1);
  --color-muted-1:   var(--color-brown-2);
}

/* ───────────────── BUTTON ───────────────── */
.sc-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
  display: inline-flex; justify-content: center; align-items: center;
  block-size: var(--height-1); padding-inline: var(--space-5); border-radius: var(--radius-3);
  font-weight: 500;
  box-shadow: var(--shadow-2);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-muted-1) 93%, #fff),
    var(--color-muted-1)
  );
  transform: translateY(0) scale(1);
  transition:
    transform 140ms cubic-bezier(.2,.8,.2,1),
    box-shadow 140ms cubic-bezier(.2,.8,.2,1),
    filter 140ms linear;
  will-change: transform, box-shadow;
}
.sc-btn--point {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-point-1) 93%, #fff),
    var(--color-point-1)
  );
}
.sc-btn--accent {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-point-2) 85%, #fff),
    var(--color-point-2)
  );
}

.sc-btn:is(:hover, :focus-visible) {
  filter: brightness(1.02);
}
.sc-btn:focus-visible {
  border-radius: var(--radius-3); outline: 2px dotted var(--color-muted-1); outline-offset: 2px;
}
.sc-btn:disabled {
  pointer-events: none;
  opacity: .5; cursor: default;
}
.sc-btn:not(:disabled):active {
  transform: translateY(1.5px) scale(0.985);
  box-shadow: var(--shadow-1);
  filter: brightness(0.98);
}
.sc-btn--point:not(:disabled):active {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-point-1) 96%, #000),
    var(--color-point-1)
  );
}
.sc-btn--accent:not(:disabled):active {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-point-2) 96%, #000),
    var(--color-point-2)
  );
}
@media (hover: none) {
  .sc-btn:not(:disabled):active {
    transform: translateY(2px) scale(0.98);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sc-btn { transition: none; }
}
.sc-btn.is-pressed {
  transform: translateY(1.5px) scale(0.985);
  box-shadow: var(--shadow-1);
  filter: brightness(0.98);
}
@media (hover: none) {
  .sc-btn.is-pressed {
    transform: translateY(2px) scale(0.98);
  }
}
@supports (-webkit-touch-callout: none) {
  .sc-btn { transform: translateZ(0); }
  .sc-btn.is-pressed { transform: translateY(1.5px) scale(0.985) translateZ(0); }
}

.sc-close {
  display: flex; justify-content: center; align-items: center;
  color: var(--color-muted-1); font-size: var(--font-size-5); font-weight: 500; line-height: 1;
}
.sc-close:focus-visible {
  border-radius: 9999px; outline: 2px dotted var(--color-muted-1); outline-offset: 2px;
}

.hr {
  opacity:.65; height:1px; margin: 2px 0 16px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, #A77B55 70%, #000), transparent);
}

/* ───────────────── TOAST ───────────────── */
@media (prefers-reduced-motion: no-preference) {
  .sc-toast {
    animation: sc-undo-fade-in 0.2s ease-out both;
  }
  @keyframes sc-undo-fade-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
  }
}
.sc-toast {
  transform: translateX(-50%);
  overflow: hidden; display: flex; gap: var(--space-2);
  position: fixed; z-index: var(--z-upper-1, 2001);
  left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--space-2));
  width: fit-content; padding: var(--space-2) var(--space-4); border-radius: 9999px;
  max-width: calc(100vw - var(--space-6) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  max-width: calc(100svw - var(--space-6) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  font-size: var(--font-size-2); line-height: 1;
  text-overflow: ellipsis; white-space: nowrap; word-break: keep-all;
  background: rgba(0, 0, 0, .75);
  box-shadow: var(--shadow-1);
}

/* ───────────────── LAYOUT ───────────────── */
#app {
  width: 100%; max-width: 600px; margin: 0 auto; padding: 0 var(--space-2);
}

/* 모든 주요 페이지 상단을 노치에서 띄우기 */
#home,
#shuffle,
#draw,
#about,
#support {
  display: flex; flex-direction: column;
  min-height: 100vh;   /* 기본 브라우저용 */
  min-height: 100svh;  /* 모바일 안정 고정값 */
  padding-top: var(--safe-top); padding-left: var(--safe-left); padding-right: var(--safe-right);
}

.sc-layout {
  display: flex; flex-direction: column; flex: 1 1 auto; gap: var(--space-4);
  min-height: 0;
}

.sc-actions {
  display: flex; align-items: center; gap: var(--space-2);
}
.sc-actions > * {
  flex: 1 1 0;
}
.sc-actions-wrap {
  position: static; padding: 0 0 var(--space-2);
}

.sc-scrim {
  cursor: pointer; place-items: center; display: grid;
  position: fixed; z-index: var(--z-upper-2, 2002); inset: 0;
  padding: var(--space-4);
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(2px);
}

/* HEADER */
.sc-home {
  display: inline-flex; align-items: center;
  line-height: 1; text-decoration: none;
}
.sc-home:focus-visible {
  border-radius: var(--radius-1); outline:2px dotted var(--color-muted-1); outline-offset:2px;
}
.sc-home svg {
  flex-shrink: 0;
  inline-size: 18px; block-size: 18px; margin-right: var(--space-1);
  color: #DA8953;
}
.sc-brand {
  display: flex; align-items: center;
  block-size: var(--height-1);
  font-size: var(--font-size-2); line-height: 1;
}
.sc-brand__name {
  transform: translateY(2px);
  color: #DA8953; font-weight:600; letter-spacing: .2px;
}
.sc-brand__tail {
  transform: translateY(2px);
  color: var(--color-yellow-2);
}

/* FOOTER */
.sc-footer {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding-bottom: calc(var(--space-6) + var(--safe-bottom));
  color: var(--color-text-2); font-size: var(--font-size-1); text-align: center; white-space: nowrap;
}
.sc-footer a {
  padding-inline: .1rem;
  color: var(--color-text-2); text-decoration: none; text-transform: uppercase;
}
.sc-footer a:focus-visible {
  border-radius: var(--radius-1); outline:2px dotted var(--color-muted-1); outline-offset:2px;
}
.sc-footer a.sc-aboutlink {
  color: var(--color-yellow-2); text-decoration: none;
}
.sc-footer a.sc-supportlink {
  transform: translateY(2px);
  display: inline-flex; align-items: center; gap: .15rem;
  color: var(--color-yellow-2);
}
.sc-footer .sc-supportlink__icon svg {
  inline-size: 14px; block-size: 14px;
}
.sc-footer .sc-supportlink__label {
  transform: translateY(-2px);
}

/* WAVE */
.sc-wave{
  display: flex; justify-content: center; align-items: center; gap: var(--space-2);
  inline-size: 100%; block-size: var(--height-1);
}
.sc-wave__dot {
  width: 0.7rem; height: 0.7rem; border-radius: 50%;
  background: var(--color-point-2);
  animation: wave 0.8s ease-in-out infinite;
}
@keyframes wave {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.4); }
}

/* ───────────────── SIDEBAR ───────────────── */
:root {
  --sb-w:     min(65vw, 240px);
  --sb-rail:  3px;
}
.sc-sidebar__root {
  position: fixed; z-index: var(--z-upper-2, 2002); inset: 0;
  min-block-size: 100svh;
}
.sc-sidebar {
  will-change: transform;
  overflow: visible; display:flex; flex-direction:column;
  position:absolute; z-index: var(--z-upper-3, 2003); inset-inline-start:0; inset-block:0;
  width: var(--sb-w); height:100%;
  background: var(--color-bg-1);
  box-shadow: var(--shadow-3);
  /* 노치 인디케이터 여백 */
  padding-top: calc(var(--safe-top) + var(--space-3));
  padding-bottom: 0;
}
@supports (color: color-mix(in oklab, white, black)) {
  .sc-sidebar {
    background: linear-gradient(
      to bottom,
      var(--color-bg-1) 0%,
      color-mix(in oklab, var(--color-bg-1) 88%, black 12%) 60%,
      color-mix(in oklab, var(--color-bg-1) 80%, black 20%) 100%
    );
  }
}
@supports not (color: color-mix(in oklab, white, black)) {
  .sc-sidebar {
    background:
      linear-gradient(to bottom, rgba(0 0 0 / 0) 0%, rgba(0 0 0 / .20) 100%),
      var(--color-bg-1);
  }
}

/* ── Rail mode (>=1190px): 본문 클릭 허용 ───────────────── */
@media (min-width: 1190px) {
  .sc-sidebar__root.is-rail { pointer-events: none; }
  .sc-sidebar__root.is-rail .sc-sidebar,
  .sc-sidebar__root.is-rail .sc-sidebar__close-out { pointer-events: auto; }
}

/* TAB */
.sc-sidebar__tabs {
  display:flex; align-items:center; margin:0 0 var(--space-1);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.35);
}
.sc-sidebar__tabs [role="tab"] {
  overflow:hidden; justify-content:center; flex:1 1 0;
  min-width:0; height: auto; padding: var(--space-5) var(--space-1) var(--space-4);
  border-radius:0; border-bottom: var(--sb-rail) solid transparent;
  color: var(--color-text-3); text-overflow:ellipsis; text-align:center; white-space:nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.sc-sidebar__tabs [role="tab"][aria-selected="true"]{
  border-bottom-color: var(--color-point-1);
  color: var(--color-text-1); font-weight: 600;
}
.sc-sidebar__tabs button { outline: none; }

/* PANEL */
.sc-sidebar__panel{
  overflow:auto; flex:1 1 auto; min-height:0;
  padding: 0 0 var(--safe-bottom); scroll-padding-bottom: var(--safe-bottom);
}
.sc-spreads, .sc-decks {
  padding-bottom: var(--space-6);
}
.sc-pick__h{
  padding: var(--space-5) var(--space-4) var(--space-1);
  color: var(--color-yellow-2); font-size: var(--font-size-2); font-weight: normal; letter-spacing:.2px;
}
.sc-pick__list{
  list-style:none; display:block; margin:0; padding:0;
}
.sc-pick__item{
  display:flex; align-items:center; justify-content:space-between; gap: var(--space-2);
  width:100%; min-block-size: var(--height-2); padding-inline: var(--space-4);
  border-radius:0; border:0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.35);
  text-align:left;
  transition: background-color .12s ease, border-color .12s ease;
}
.sc-pick__item:focus-visible{
  outline:2px dotted var(--color-muted-1); outline-offset:-2px;
}
.sc-pick__item.is-active{
  position:relative;
  background: var(--color-green-1);
}
.sc-pick__item.is-active::before{
  content:"";
  position:absolute; inset-inline-start:0; inset-block:0;
  inline-size: var(--sb-rail);
  background: var(--color-point-1);
}
.sc-pick__count {
  color: var(--color-point-1); font-size: var(--font-size-1); line-height:1.35;
}
.sc-pick__count span { display: inline-block; }
.sc-pick__badge{
  min-inline-size:1.35rem; padding-inline: var(--space-1); border-radius:9999px;
  font-size: var(--font-size-1); line-height:1.35; text-align:center;
  background: var(--color-point-1);
}
.sc-pick__badge span { display: inline-block; }

/* CLOSE */
.sc-sidebar__close-out{
  transform: translateY(-50%);
  display:flex; justify-content:center; align-items:center;
  position: fixed; z-index: var(--z-upper-3, 2003);
  top: calc((100svh - var(--safe-top) - var(--safe-bottom)) / 2 + var(--safe-top));
  inline-size: var(--height-2); block-size: var(--height-2); border-radius: 9999px;
  color: var(--color-muted-1); font-size: 3rem;
}
@supports not (height: 1svh) {
  .sc-sidebar__close-out { top: 50%; transform: translateY(-50%); }
}
.sc-sidebar__close-out.is-left { left: calc(var(--sb-w) + var(--space-2)); }
.sc-sidebar__close-out.is-right { right: calc(var(--sb-w) + var(--space-2)); }
.sc-sidebar__close-out:focus-visible { outline: 2px dotted var(--color-muted-1); outline-offset: 2px; }

/* ───────────────── HOME: Display ───────────────── */
.sc-chevron {
  inline-size: 16px; block-size: 16px; margin-right: var(--space-1);
  color: var(--color-muted-1); line-height: 1;
}
.sc-edit {
  display: inline-flex; justify-content: center; align-items: center;
  inline-size: 32px; block-size: 32px; border-radius: 9999px;
  color: var(--color-muted-1);
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.sc-edit svg {
  inline-size: 22px; block-size: 22px;
}

.sc-display {
  overflow: hidden; position: relative;
  padding: 0; border-radius: var(--radius-2); border: 1px solid var(--color-muted-1);
  background: var(--color-bg-1);
  box-shadow: var(--shadow-3);
}
.sc-display__top{
  display:grid; grid-template-columns: 1fr auto; align-items:center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-1);
}
.sc-display__top--with-body{
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.35);
}
@media (max-height: 560px){
  .sc-display__top--with-body{
    border-bottom: 0;
    box-shadow: none;
  }
}
.sc-display__body { padding: var(--space-4); }

/* Billboard */
.sc-billboard:focus-visible {
  border-radius: var(--radius-1); outline: 2px dotted var(--color-muted-1); outline-offset: 2px;
}
.sc-billboard__meta {
  display:grid; grid-template-columns: auto 1fr;
  align-items: center; width: 100%; min-width:0; min-block-size: var(--height-1);
  padding: 0; border: 0;
  text-align: left;
}
.sc-billboard__title {
  color: var(--color-yellow-2); font-size: var(--font-size-4); font-weight: 600;
  line-height: 1; letter-spacing: .2px;
}
.sc-billboard.is-empty .sc-billboard__title { color: var(--color-text-2); }

/* SpreadInfo */
.sc-display__body[aria-hidden="true"] { font-size: var(--font-size-3); }
.sc-display .sc-guide__text           { color: var(--color-text-2); }
.sc-display .sc-guide__placeholder    { color: var(--color-text-3); }
.sc-display .sc-guide__text strong,
.sc-display .sc-guide__text em        { color: var(--color-point-1); font-weight:600; }

/* Recommend Chips */
.sc-recommend {
  list-style: none;
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2);
  margin: 0; padding: 0;
}
@media (max-width: 344px) {
  .sc-recommend { grid-template-columns: 1fr; }
}
.sc-recommend__main {
  color: var(--color-text-1); font-size: var(--font-size-3); font-weight: 600; line-height: 1.3;
}
.sc-recommend__sub  {
  color: var(--color-text-2); font-size: var(--font-size-2); line-height: .85;
}

.sc-recommend__chip{
  display: flex; flex-direction: column; align-items: flex-start; gap: .125rem;
  position: relative;
  padding: var(--space-2) var(--space-4) var(--space-2); border-radius: var(--radius-2); border: 1px solid var(--color-muted-1);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0));
  box-shadow: var(--shadow-1);
  transition:
    border-color .12s ease,
    box-shadow .12s ease,
    background-color .12s ease;
}
.sc-recommend__chip.is-active{
  border-color: var(--color-point-1);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-point-1) 36%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-point-1) 14%, rgba(255,255,255,0)),
    color-mix(in srgb, var(--color-point-1) 02%, rgba(255,255,255,0))
  );
}
.sc-recommend__chip.is-active .sc-recommend__main {
  color: var(--color-yellow-2);
}
@media (prefers-reduced-motion: no-preference) {
  .sc-recommend__chip {
    transform-origin: center;
    animation: sc-chip-pop .16s ease-out both;
  }
  .sc-recommend__chip:nth-child(2) { animation-delay: .02s; }
  .sc-recommend__chip:nth-child(3) { animation-delay: .04s; }
  .sc-recommend__chip:nth-child(4) { animation-delay: .06s; }

  @keyframes sc-chip-pop {
    from {
      opacity: 0;
      transform: translateY(4px) scale(.97);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
}
.sc-recommend__chip:active {
  transform: translateY(1px) scale(.99);
  box-shadow: var(--shadow-2);
}

/* ───────────────── HOME: InputFields ───────────────── */
.sc-textarea {
  resize: none; overflow-y: hidden; display:block;
  width:100%; min-height: 73px; padding: var(--space-3) var(--space-3) var(--space-2);
  border-radius: var(--radius-2); border: 1px solid var(--color-muted-1);
  font-size: var(--font-size-3); line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
.sc-textarea::placeholder { color: var(--color-text-2); }
.sc-textarea:focus-visible { outline: none; border-color: var(--color-point-2); }

.sc-question {
  display: grid; gap: var(--space-2); margin-top: 2px;
}
.sc-question__field{
  position: relative;
}
.sc-question__meta{
  position:absolute; right: var(--space-3); bottom:var(--space-2);
  color: var(--color-text-3); font-size: var(--font-size-1); letter-spacing: .2px;
}

/* ───────────────── HOME: PositionInputEditor ───────────────── */
.sc-input {
  width: 100%; padding: var(--space-2) var(--space-2) var(--space-1);
  border-radius: var(--radius-2); border: 1px solid var(--color-muted-1);
  font-size: var(--font-size-3);
}
.sc-input::placeholder { color: var(--color-muted-1); }
.sc-input:focus-visible { outline: none; border-color: var(--color-point-2); }

@supports (-webkit-touch-callout: none) {
  @media (hover: none) and (pointer: coarse) {
    .sc-editor .sc-close {
      padding-top: var(--space-1); padding-right: var(--space-2);
    }
  }
}
.sc-editor-host {
  padding: 0 0 var(--space-2);
}
.sc-editor {
  position: relative;
  padding: 0; border-radius: var(--radius-2); border: 1px solid var(--color-muted-1);
  background: var(--color-bg-1);
  box-shadow: var(--shadow-3);
}
.sc-editor:focus,
.sc-editor:focus-visible { outline: none; }
.sc-editor__top {
  display:grid; grid-template-columns: 1fr auto; align-items:center;
  padding: var(--space-2) var(--space-3) var(--space-1);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.35);
}
.sc-editor__meta {
  display:grid; grid-template-columns: auto 1fr;
  align-items: center; width: 100%; min-width:0; min-block-size: var(--height-1);
  padding: 0; border: 0; text-align: left;
}
.sc-editor__title {
  color: var(--color-yellow-2); font-size: var(--font-size-4); font-weight: 600; line-height: 1; letter-spacing: .2px;
}
.sc-editor__body {
  -webkit-overflow-scrolling: touch;
  overflow: auto; display: grid; gap: var(--space-2);
  padding: var(--space-4);
}
.sc-editor__footer{
  display: flex; justify-content: right; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-4);
}
.sc-editor form {
  display: grid; gap: var(--space-2);
}
.sc-editor__row {
  display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: var(--space-2);
  min-block-size: var(--height-1);
}
.sc-editor__order {
  display: inline-flex; justify-content: center; align-items: center;
  inline-size: 28px; block-size: 28px; border-radius: var(--radius-1);
  font-size: var(--font-size-2); font-weight: 600; line-height: 1;
  background: var(--color-muted-1);
}
@media (max-width: 344px) {
  .sc-editor__row   { grid-template-columns: 1fr; }
  .sc-editor__order { display: none; }
}

.sc-editor__quick {
  display: grid; grid-template-columns: 1fr auto; row-gap: var(--space-2); column-gap: var(--space-2);
  padding-bottom: var(--space-2);
}
.sc-editor__quick .sc-editor__actions { justify-content: flex-end; }
.sc-editor__quick .sc-editor__row { grid-column: 1 / -1; }
.sc-editor__quick .sc-help{
  align-self: center; margin-top: calc(-1 * var(--space-5)); padding-left: 2.25rem;
  font-size: var(--font-size-1); letter-spacing: .2px;
}
.sc-editor__actions {
  display: flex; align-items: center; gap: var(--space-2);
  position: sticky; bottom: 0; padding-top: var(--space-2);
}
.sc-editor__actions--inline{ position: static; padding-top: 0; background: none; }

/* ───────────────── STAGE ───────────────── */
:root {
  --stage-max: 600px;
  --stage-ratio: 1.25;
  --stage-extra: 0px;
}
.sc-stage {
  container-type: inline-size; flex: 1 1 auto; position: relative;
  min-block-size: 0; margin-bottom: var(--space-4); border-radius: var(--radius-2);
  background: var(--color-bg-1);
  box-shadow: var(--shadow-2);
}
.sc-stage::before {
  content:""; opacity:.95; pointer-events:none;
  position:absolute; inset:7px;
  border-radius: var(--radius-2); border: 1px dashed var(--color-muted-1);
}
@supports (width: 1cqi) {
  .sc-stage {
    min-block-size: calc(min(100cqi, var(--stage-max)) * var(--stage-ratio) - var(--stage-extra));
  }
}
@supports not (width: 1cqi) {
  .sc-stage {
    min-block-size: calc(min(100vw, var(--stage-max)) * var(--stage-ratio) - var(--stage-extra));
  }
}
.sc-stage__content {
  /* transform이 스태킹 컨텍스트를 만들어 자식 z-index가 갇히므로
     부모 자체를 더 높은 층으로 올려 형제(.sc-references) 위에 오게 만든다. */
  position: relative;
  z-index: var(--z-upper-2, 2002);
  transform: translateY(var(--optical-stage-shift));
  transition: transform 160ms ease-out;
}

/* CARD ANIMATION */
.sc-animation {
  transform: translateX(-50%);
  overflow: hidden; display:flex; justify-content:center; align-items:center;
  position: absolute; z-index: var(--z-upper-2, 2002);
  left: 50%; top: 12px; right: auto; bottom: auto;
  inline-size: min(100%, var(--stage-max)); aspect-ratio: 4 / 5;
}

/* REFERENCE */
.sc-references{
  transform: translateX(-50%);
  display: flex; flex-direction: column;
  position: absolute; z-index: var(--z-upper-1, 2001);
  left: 50%; right: auto; bottom: 0; top: auto;
  inline-size: min(100%, var(--stage-max)); min-width: 0;
  padding: 0 var(--space-3) var(--space-3);
}
.sc-reference {
  width: 100%; margin-top: var(--space-1); padding: .35rem var(--space-2) var(--space-1); border-radius: var(--radius-1);
  color: var(--color-text-2); font-size: var(--font-size-2);
  background: rgba(0,0,0,.18);
}
.sc-reference p {
  max-inline-size: 100%; margin: 0;
  white-space: normal; word-break: keep-all; overflow-wrap: anywhere;
}
@supports not (overflow-wrap: anywhere) {
  .sc-reference p { word-break: break-all; }
}
.sc-reference__label {
  flex: 0 0 auto; margin-right: var(--space-1);
  color: var(--color-text-1); font-weight: 500; white-space: nowrap;
}

/* ───────────────── PROMPT ───────────────── */
.sc-copy {
  display: inline-flex; align-items: center; gap: .1rem;
  border-radius: var(--radius-1);
  color: var(--color-muted-1); font-size: var(--font-size-2); font-weight: normal;
  line-height: 1;
}
.sc-copy svg {
  display: block; flex-shrink: 0;
  inline-size: 22px; block-size: 22px;
}
.sc-copy__label {
  position: relative; top: 0.2em;
}

.sc-ai {
  display: inline-flex; align-items: center; gap: .1rem;
  margin-left: var(--space-1); border-radius: var(--radius-1);
  color: var(--color-muted-1); font-size: var(--font-size-2); font-weight: normal;
  line-height: 1;
}
.sc-ai svg {
  transform: translateY(1px);
  display: block; flex-shrink: 0;
  inline-size: 22px; block-size: 22px;
}
.sc-ai__label {
  position: relative; top: 0.2em;
}

@media (prefers-reduced-motion: no-preference) {
  .sc-prompt {
    transform-origin: center;
    animation: sc-prompt-pop .14s ease-out both;
  }
  @keyframes sc-prompt-pop {
    from { opacity: .0; transform: translateY(4px) scale(.98); }
    to   { opacity: 1;  transform: translateY(0)   scale(1); }
  }
}
.sc-prompt{
  overflow: hidden; display: flex; flex-direction: column;
  position: absolute; z-index: var(--z-upper-3, 2003); inset: 0;
  margin: var(--space-2) 0;
}
.sc-prompt__bar{
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--space-2);
  margin: 0 var(--space-2);
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.35);
}
@supports (-webkit-touch-callout: none) {
  @media (hover: none) and (pointer: coarse) {
    .sc-prompt__bar { padding-bottom: var(--space-2); }
  }
}
.sc-prompt__title{
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-width: 0; margin: 0;
  font-size: var(--font-size-3); font-weight: 500; line-height: 1.1;
}

.sc-prompt__body{
  position: relative;
  overflow: visible; display: flex; flex-direction: column; flex: 1 1 auto;
  min-height: 0;
}
.sc-prompt__body::before {
  pointer-events:none;
  opacity: var(--fade-top, 0); content:"";
  position:absolute; z-index:1; left:var(--space-2); right:var(--space-2); top:0;
  height:12px;
  background: linear-gradient(to bottom, rgba(0,0,0,.18), transparent);
  transition: opacity .15s ease;
}
.sc-prompt__body::after {
  pointer-events:none;
  opacity: var(--fade-bottom, 0); content:"";
  position:absolute; z-index:1; left:var(--space-2); right:var(--space-2); bottom:0;
  height:12px;
  background: linear-gradient(to top, rgba(0,0,0,.18), transparent);
  transition: opacity .15s ease;
}

.sc-prompt__text{
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  overflow: auto; display: flex; flex-direction: column; flex: 1 1 auto;
  position: relative; min-height: 0; margin: 0 var(--space-2);
  border-bottom-left-radius: var(--radius-2); border-bottom-right-radius: var(--radius-2);
  color: var(--color-text-2); font: inherit; font-size: var(--font-size-2); line-height: 1.5;
}
.sc-prompt__block {
  flex: 0 0 auto;
  min-height: 0; max-width: 100%; margin: 0 var(--space-1); padding: var(--space-4) var(--space-3) var(--space-4);
  color: var(--color-text-2); font: inherit; font-size: var(--font-size-2); line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}
.loading {
  margin: -.55rem var(--space-1) 0; margin-top: var(--space-2); padding: 0 var(--space-3);
}
.sc-reading-notice {
  margin: 0 var(--space-1); padding: var(--space-1) var(--space-3) var(--space-4);
}
.sc-reading-q {
  margin: 0 var(--space-1); padding: var(--space-4) var(--space-3) 0;
  color: var(--color-text-1);
}
.sc-reading-q p::before {
  content: "\275D"; /* ❝ */
  margin-right: .25rem;
  color: var(--color-text-1); font-size: var(--font-size-2);
}
.sc-reading-q p::after {
  content: "\275E"; /* ❞ */
  margin-left: .25rem;
  color: var(--color-text-1); font-size: var(--font-size-2);
}

/* PC 스크롤바 */
@media (hover: hover) and (pointer: fine) {
  .sc-prompt{
    --sc-scroll-track: color-mix(in oklab, var(--color-bg-1) 92%, black);
    --sc-scroll-thumb: color-mix(in oklab, var(--color-text-2) 32%, transparent);
    --sc-scroll-thumb-hover: color-mix(in oklab, var(--color-text-2) 48%, transparent);
    --sc-scroll-thumb-active: color-mix(in oklab, var(--color-text-2) 64%, transparent);
  }
  /* Firefox */
  .sc-prompt .sc-prompt__text{
    scrollbar-width: thin;
    scrollbar-color: var(--sc-scroll-thumb) var(--sc-scroll-track);
  }
  /* Chromium · WebKit */
  :global(.sc-prompt .sc-prompt__text::-webkit-scrollbar){ width: 12px; }
  :global(.sc-prompt .sc-prompt__text::-webkit-scrollbar-track){
    background: var(--sc-scroll-track); border-radius: 8px;
  }
  :global(.sc-prompt .sc-prompt__text::-webkit-scrollbar-thumb){
    background-color: var(--sc-scroll-thumb);
    border-radius: 8px; border: 3px solid transparent; background-clip: padding-box;
  }
  :global(.sc-prompt .sc-prompt__text:hover::-webkit-scrollbar-thumb){
    background-color: var(--sc-scroll-thumb-hover);
  }
  :global(.sc-prompt .sc-prompt__text::-webkit-scrollbar-thumb:active){
    background-color: var(--sc-scroll-thumb-active);
  }
  :global(.sc-prompt .sc-prompt__text::-webkit-scrollbar-corner){ background: transparent; }
}

/* ───────────────── ABOUT ───────────────── */
.sc-about {
  display: grid; gap: var(--space-5);
  padding: 0 0 var(--space-2);
}

@media (prefers-reduced-motion: no-preference) {
  .sc-hero, .sc-section {
    animation: sc-fade-in .18s ease-out both;
  }
  @keyframes sc-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* HERO */
.sc-hero{
  overflow: hidden; position: relative;
  padding: calc(var(--space-6) + 2px) var(--space-5) var(--space-5);
  border-radius: var(--radius-2); border: 1px solid var(--color-muted-1);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-1) 92%, #000), var(--color-bg-1)),
    radial-gradient(120% 80% at 80% -10%, color-mix(in srgb, var(--color-point-2) 10%, transparent), transparent),
    radial-gradient(120% 80% at -10% 120%, color-mix(in srgb, var(--color-point-1) 10%, transparent), transparent);
  box-shadow: var(--shadow-3);
}
.sc-kicker{
  display: inline-block;
  margin-bottom: var(--space-2); padding: 2px 8px; border-radius: 9999px;
  color: var(--color-text-1); font-size: var(--font-size-1); letter-spacing: .2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-point-2) 85%, #fff), var(--color-point-2));
}
.sc-hero__title{
  font-size: clamp(1.5rem, 3.5vw, 2rem); font-weight: 700; line-height: 1.15; letter-spacing: .2px;
}
.sc-hero__lead{
  list-style: none;
  margin-top: var(--space-2);
  color: var(--color-text-2); font-size: var(--font-size-2);
}
.sc-hero__lead a {
  color: var(--color-text-2); text-decoration: none;
}

/* Sticky TOC */
.sc-about__toc{
  display: inline-flex; align-items: center; gap: var(--space-2);
  position: sticky; top: calc(var(--safe-top) + var(--space-2));
  margin-top: var(--space-4);
}
.sc-about__toc span {
  color: var(--color-text-3);
}
.sc-toc__link{
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-radius: 9999px; border: 1px solid var(--color-muted-1);
  font-size: var(--font-size-2); color: var(--color-text-1);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0));
  box-shadow: var(--shadow-1);
  transition: border-color .12s ease, box-shadow .12s ease, transform .06s ease;
}

/* SECTION */
.sc-section{
  overflow: hidden;
  border-radius: var(--radius-2); border: 1px solid var(--color-muted-1);
  background: var(--color-bg-1);
  box-shadow: var(--shadow-3);
}
.sc-section__title{
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  padding: var(--space-3) var(--space-4) var(--space-2);
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: var(--color-yellow-2); font-size: var(--font-size-4); font-weight: 600; letter-spacing: .2px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.35);
}
.sc-section__body{
  display: grid; gap: var(--space-3);
  padding: var(--space-4);
  font-size: var(--font-size-3)
}
.sc-section__body .sc-join {
  color: var(--color-yellow-2);
}
.sc-note {
  color: var(--color-text-2); font-size: var(--font-size-2);
}
.sc-quote{
  margin: var(--space-1) 0 0; padding: var(--space-3);
  border-radius: var(--radius-1); border-left: 3px solid var(--color-point-1);
  color: var(--color-text-2); font-size: var(--font-size-3);
  background: color-mix(in srgb, var(--color-bg-1) 90%, #000);
}
.sc-quote .sc-note {
  margin-top: var(--space-1);
}

/* CREDITS */
.sc-roles {
  list-style: none; display: grid; gap: var(--space-1);
  margin: 0; padding: 0;
}
.sc-summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: var(--space-1);
  border-radius: var(--radius-1);
  color: var(--color-text-2); line-height: 1.35;
  transition: background-color .12s ease;
}
.sc-summary::-webkit-details-marker {
  display: none;
}
.sc-summary .ico{
  transform: translateY(-2px); transform-origin: center;
  display: block; justify-content: center; align-items: center;
  color: var(--color-yellow-2); line-height: 0;
  transition: transform .15s ease;
}
.sc-fineprint > p {
  margin-top: var(--space-1);
  color: var(--color-text-2);
}
.sc-fineprint[open] .sc-summary .ico {
  transform: translateY(-2px) rotate(180deg);
}

/* HISTORY */
.sc-timeline{
  list-style: none; display: grid; gap: var(--space-3);
  margin: 0; padding: 0 0 0 var(--space-2);
  border-left: 2px solid color-mix(in srgb, var(--color-muted-1) 70%, transparent);
  font-size: var(--font-size-3);
}
.sc-timeline > li{
  position: relative; padding-left: var(--space-2);
}
.sc-timeline > li::before{
  content: ""; position: absolute; left: -13px; top: .55rem;
  width: .5rem; height: .5rem; border-radius: 9999px;
  background: radial-gradient(circle at 30% 30%, #fff, color-mix(in srgb, var(--color-point-1) 60%, transparent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-point-1) 36%, transparent);
}
.sc-timeline time{
  display: inline-block; min-width: 7.5rem;
  color: var(--color-text-2); font-size: var(--font-size-2);
}
.sc-timeline em{
  color: var(--color-yellow-2); font-style: normal;
}
