@property --ed-bg {
  syntax: "<color>";
  inherits: true;
  initial-value: #ffffff;
}
@property --ed-fg {
  syntax: "<color>";
  inherits: true;
  initial-value: #17141a;
}
@property --tok-key {
  syntax: "<color>";
  inherits: true;
  initial-value: #0a4fe8;
}
@property --tok-str {
  syntax: "<color>";
  inherits: true;
  initial-value: #9d88c4;
}
@property --tok-num {
  syntax: "<color>";
  inherits: true;
  initial-value: #c2361a;
}
@property --tok-com {
  syntax: "<color>";
  inherits: true;
  initial-value: #6b6577;
}
html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #17141a;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.th {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 400px);
}

.th__panel[data-theme=light] {
  --ed-bg: #ffffff;
  --ed-fg: #17141a;
  --tok-key: #0a4fe8;
  --tok-str: #9d88c4;
  --tok-num: #c2361a;
  --tok-com: #6b6577;
  color-scheme: light;
}

.th__panel[data-theme=dark], .th__panel[data-theme=hc] {
  --tok-key: #ffd23f;
  --tok-str: #3ddc97;
  --tok-num: #6ec8ff;
  color-scheme: dark;
}

.th__panel[data-theme=dark] {
  --ed-bg: #231f28;
  --ed-fg: #fff7e6;
  --tok-com: #9a93a6;
}

.th__panel[data-theme=hc] {
  --ed-bg: #000000;
  --ed-fg: #ffffff;
  --tok-com: #cfc8d9;
}

.th__panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: var(--ed-bg);
  color: var(--ed-fg);
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}

.th__bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.th__ico {
  display: grid;
  place-items: center;
  color: var(--tok-key);
  font-size: 15px;
}

.th__name {
  flex: 1 1 auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.4;
}

.th__cur {
  display: inline-grid;
  padding: 4px 8px;
  border: 1px solid var(--tok-key);
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.4;
}

.th__curName {
  grid-area: 1/1;
  visibility: hidden;
}

.th__cur[data-cur=light] .th__curName[data-set=light],
.th__cur[data-cur=dark] .th__curName[data-set=dark],
.th__cur[data-cur=hc] .th__curName[data-set=hc] {
  visibility: visible;
}

.th__code {
  margin: 0;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
  font-weight: 500;
  font-size: clamp(11px, 3vw, 13px);
  line-height: 20px;
  letter-spacing: 0;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  overscroll-behavior: contain;
}

.t--k {
  color: var(--tok-key);
}

.t--s {
  color: var(--tok-str);
}

.t--n {
  color: var(--tok-num);
}

.t--com {
  color: var(--tok-com);
}

.th__panel[data-theme=hc] .th__code {
  font-weight: 700;
}

.th__panel[data-theme=hc] .t--com {
  font-weight: 500;
}

.th__opts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.th__opt {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  width: 100%;
  padding: 4px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff7e6;
  font-family: inherit;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
}

.th__opt[aria-pressed=true] {
  background: #fff7e6;
  color: #17141a;
  border-color: #fff7e6;
}

.th__opt:focus-visible {
  outline: 2px solid #ffd23f;
  outline-offset: 2px;
}

.th__dots {
  display: inline-flex;
  gap: 4px;
}

.th__dot {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255, 247, 230, 0.4);
  border-radius: 50%;
  box-sizing: border-box;
}

.th__opt[data-set=light] .th__dot--1 {
  background: #ffffff;
}

.th__opt[data-set=light] .th__dot--2 {
  background: #0a4fe8;
}

.th__opt[data-set=light] .th__dot--3 {
  background: #9d88c4;
}

.th__opt[data-set=dark] .th__dot--1 {
  background: #231f28;
}

.th__opt[data-set=dark] .th__dot--2 {
  background: #ffd23f;
}

.th__opt[data-set=dark] .th__dot--3 {
  background: #3ddc97;
}

.th__opt[data-set=hc] .th__dot--1 {
  background: #000000;
}

.th__opt[data-set=hc] .th__dot--2 {
  background: #ffd23f;
}

.th__opt[data-set=hc] .th__dot--3 {
  background: #ffffff;
}

.th__ind {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 4px;
  height: 4px;
  border-radius: 999px;
  background: #ffd23f;
  transform: scaleX(0);
  transform-origin: left center;
}

.th__opt[aria-pressed=true] .th__ind {
  transform: scaleX(1);
  background: #17141a;
}

.th.is-demo .th__panel {
  animation-name: thBg, thFg, thKey, thStr, thNum, thCom;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.th.is-demo .th__opt {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.th.is-demo .th__curName {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.th.is-demo .th__curName[data-set=light] {
  animation-name: thName1;
}

.th.is-demo .th__curName[data-set=dark] {
  animation-name: thName2;
}

.th.is-demo .th__curName[data-set=hc] {
  animation-name: thName3;
}

.th.is-demo .th__opt:nth-child(1) {
  animation-name: thOpt1;
}

.th.is-demo .th__opt:nth-child(2) {
  animation-name: thOpt2;
}

.th.is-demo .th__opt:nth-child(3) {
  animation-name: thOpt3;
}

.th.is-demo .th__ind {
  animation-duration: 2s;
  animation-iteration-count: infinite;
}

.th.is-demo .th__opt:nth-child(1) .th__ind {
  animation-name: thInd1;
}

.th.is-demo .th__opt:nth-child(2) .th__ind {
  animation-name: thInd2;
}

.th.is-demo .th__opt:nth-child(3) .th__ind {
  animation-name: thInd3;
}

@keyframes thBg {
  0%, 9% {
    --ed-bg: #ffffff;
  }
  10%, 39% {
    --ed-bg: #231f28;
  }
  40%, 69% {
    --ed-bg: #000000;
  }
  70%, 100% {
    --ed-bg: #ffffff;
  }
}
@keyframes thFg {
  0%, 9% {
    --ed-fg: #17141a;
  }
  10%, 39% {
    --ed-fg: #fff7e6;
  }
  40%, 69% {
    --ed-fg: #ffffff;
  }
  70%, 100% {
    --ed-fg: #17141a;
  }
}
@keyframes thKey {
  0%, 9% {
    --tok-key: #0a4fe8;
  }
  10%, 100% {
    --tok-key: #ffd23f;
  }
}
@keyframes thStr {
  0%, 9% {
    --tok-str: #9d88c4;
  }
  10%, 100% {
    --tok-str: #3ddc97;
  }
}
@keyframes thNum {
  0%, 9% {
    --tok-num: #c2361a;
  }
  10%, 100% {
    --tok-num: #6ec8ff;
  }
}
@keyframes thCom {
  0%, 9% {
    --tok-com: #6b6577;
  }
  10%, 39% {
    --tok-com: #9a93a6;
  }
  40%, 69% {
    --tok-com: #cfc8d9;
  }
  70%, 100% {
    --tok-com: #6b6577;
  }
}
@keyframes thName1 {
  0%, 9% {
    visibility: visible;
  }
  10%, 69% {
    visibility: hidden;
  }
  70%, 100% {
    visibility: visible;
  }
}
@keyframes thName2 {
  0%, 9% {
    visibility: hidden;
  }
  10%, 39% {
    visibility: visible;
  }
  40%, 100% {
    visibility: hidden;
  }
}
@keyframes thName3 {
  0%, 39% {
    visibility: hidden;
  }
  40%, 69% {
    visibility: visible;
  }
  70%, 100% {
    visibility: hidden;
  }
}
@keyframes thOpt1 {
  0%, 9% {
    background: #fff7e6;
    color: #17141a;
  }
  10%, 69% {
    background: rgba(255, 255, 255, 0.08);
    color: #fff7e6;
  }
  70%, 100% {
    background: #fff7e6;
    color: #17141a;
  }
}
@keyframes thOpt2 {
  0%, 9% {
    background: rgba(255, 255, 255, 0.08);
    color: #fff7e6;
  }
  10%, 39% {
    background: #fff7e6;
    color: #17141a;
  }
  40%, 100% {
    background: rgba(255, 255, 255, 0.08);
    color: #fff7e6;
  }
}
@keyframes thOpt3 {
  0%, 39% {
    background: rgba(255, 255, 255, 0.08);
    color: #fff7e6;
  }
  40%, 69% {
    background: #fff7e6;
    color: #17141a;
  }
  70%, 100% {
    background: rgba(255, 255, 255, 0.08);
    color: #fff7e6;
  }
}
@keyframes thInd1 {
  0%, 9% {
    transform: scaleX(1);
    background: #17141a;
    animation-timing-function: steps(1, end);
  }
  10%, 69% {
    transform: scaleX(0);
    background: #ffd23f;
    animation-timing-function: steps(1, end);
  }
  70% {
    transform: scaleX(0);
    background: #17141a;
    animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  }
  86%, 100% {
    transform: scaleX(1);
    background: #17141a;
  }
}
@keyframes thInd2 {
  0%, 9% {
    transform: scaleX(0);
    background: #ffd23f;
    animation-timing-function: steps(1, end);
  }
  10% {
    transform: scaleX(0);
    background: #17141a;
    animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  }
  26%, 39% {
    transform: scaleX(1);
    background: #17141a;
    animation-timing-function: steps(1, end);
  }
  40%, 100% {
    transform: scaleX(0);
    background: #ffd23f;
  }
}
@keyframes thInd3 {
  0%, 39% {
    transform: scaleX(0);
    background: #ffd23f;
    animation-timing-function: steps(1, end);
  }
  40% {
    transform: scaleX(0);
    background: #17141a;
    animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  }
  56%, 69% {
    transform: scaleX(1);
    background: #17141a;
    animation-timing-function: steps(1, end);
  }
  70%, 100% {
    transform: scaleX(0);
    background: #ffd23f;
  }
}
@media (max-width: 340px) {
  .th {
    gap: 4px;
  }
  .th__panel {
    padding: 8px;
    gap: 4px;
  }
  .th__code {
    font-size: 11px;
    line-height: 16px;
    padding: 4px;
  }
  .th__name {
    font-size: 11px;
  }
  .th__cur {
    font-size: 10px;
    padding: 0 4px;
  }
  .th__opts {
    gap: 4px;
  }
  .th__opt {
    font-size: 10px;
    padding: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .th.is-demo .th__panel,
  .th.is-demo .th__curName,
  .th.is-demo .th__opt,
  .th.is-demo .th__ind {
    animation: none !important;
  }
}
