:root {
  --desktop: #15091b;
  --desktop-2: #2a0c36;
  --chrome: #e7e0e4;
  --chrome-light: #fffafc;
  --chrome-mid: #aaa0a9;
  --chrome-dark: #504650;
  --paper: #f7f2f4;
  --ink: #1b121b;
  --muted: #6d626c;
  --purple: #3d005b;
  --pink: #ffb0d7;
  --lime: #d1e59a;
  --line: #b9aeb7;
  --ui: "SFMono-Regular", "Roboto Mono", Consolas, monospace;
  --display: Georgia, "Times New Roman", "Noto Serif KR", serif;
  --body: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--desktop);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 176, 215, .22), transparent 31rem),
    radial-gradient(circle at 88% 92%, rgba(209, 229, 154, .14), transparent 27rem),
    linear-gradient(145deg, var(--desktop-2), #09070b 68%);
  font-family: var(--body);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  content: "";
  opacity: .18;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, .045) 3px 4px);
  mix-blend-mode: soft-light;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: white;
  background: var(--purple);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.desktop {
  min-height: 100vh;
  padding: clamp(24px, 4vh, 52px) clamp(14px, 4vw, 64px) 22px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  overflow: hidden;
}

.desktop::before,
.desktop::after {
  position: fixed;
  z-index: 0;
  content: "";
  pointer-events: none;
}

.desktop::before {
  width: 44vw;
  max-width: 670px;
  aspect-ratio: 1;
  left: -14vw;
  bottom: -32vw;
  border: 1px solid rgba(255, 176, 215, .3);
  border-radius: 50%;
  box-shadow: 0 0 0 11vw rgba(255, 176, 215, .025), 0 0 0 19vw rgba(255, 176, 215, .02);
}

.desktop::after {
  top: 10vh;
  right: 3vw;
  width: min(24vw, 320px);
  height: min(24vw, 320px);
  opacity: .18;
  background:
    linear-gradient(45deg, transparent 46%, var(--pink) 47% 53%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, var(--pink) 47% 53%, transparent 54%);
}

.desktop-copy,
.desktop-note {
  position: relative;
  z-index: 2;
  width: min(1180px, 100%);
  margin: 0;
  color: rgba(255, 255, 255, .62);
  font: 10px/1.2 var(--ui);
  letter-spacing: .12em;
}

.desktop-copy {
  display: flex;
  justify-content: space-between;
}

.desktop-note {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, .5);
}

.app-window {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 38px 38px minmax(0, 1fr) 64px;
  width: min(1180px, 100%);
  height: min(820px, calc(100vh - 122px));
  min-height: 620px;
  overflow: hidden;
  background: var(--chrome);
  border: 2px solid var(--chrome-light);
  border-right-color: var(--chrome-dark);
  border-bottom-color: var(--chrome-dark);
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, .9),
    inset -2px -2px rgba(64, 52, 63, .52),
    18px 24px 70px rgba(0, 0, 0, .55);
}

.title-bar,
.detail-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  color: white;
  background: linear-gradient(90deg, #280041, var(--purple) 55%, #7d1b65);
  border-bottom: 2px solid var(--chrome-dark);
  font: 12px/1 var(--ui);
  letter-spacing: .04em;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding-left: 6px;
}

.app-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--purple);
  background: var(--pink);
  border: 1px solid white;
  font: 700 13px/1 var(--display);
}

.window-actions {
  display: flex;
  height: 100%;
}

.window-actions span {
  display: grid;
  width: 36px;
  place-items: center;
  color: var(--ink);
  background: var(--chrome);
  border-left: 2px solid var(--chrome-light);
  border-right: 2px solid var(--chrome-dark);
  border-top: 2px solid var(--chrome-light);
  border-bottom: 2px solid var(--chrome-dark);
  font: 700 16px/1 var(--ui);
}

.menu-bar {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 38px);
  padding: 0 14px;
  background: var(--chrome);
  border-top: 1px solid white;
  border-bottom: 2px solid var(--chrome-mid);
  font: 12px/1 var(--ui);
}

.menu-bar a {
  text-decoration: none;
}

.menu-bar a:last-child {
  margin-left: auto;
}

.menu-bar a:hover,
.menu-bar a:focus-visible {
  color: var(--purple);
  background: var(--pink);
  outline: 2px solid var(--purple);
  outline-offset: 4px;
}

.app-scroll {
  min-height: 0;
  overflow: auto;
  scrollbar-color: var(--purple) var(--chrome);
  scrollbar-width: auto;
  background: var(--paper);
}

.app-scroll::-webkit-scrollbar {
  width: 18px;
}

.app-scroll::-webkit-scrollbar-track {
  background: var(--chrome);
  border-left: 2px solid var(--chrome-dark);
}

.app-scroll::-webkit-scrollbar-thumb {
  background: var(--pink);
  border: 3px solid var(--chrome);
  outline: 1px solid var(--purple);
}

.profile {
  position: relative;
  display: grid;
  grid-template-columns: 150px minmax(300px, 1fr) auto;
  gap: 24px;
  min-height: 190px;
  padding: 26px 30px 24px;
  border-bottom: 2px solid var(--chrome-dark);
  background:
    linear-gradient(90deg, rgba(255, 176, 215, .2), transparent 36%),
    var(--paper);
}

.profile::after {
  position: absolute;
  right: 27%;
  bottom: 0;
  width: 22%;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--lime));
}

.profile-mark {
  display: grid;
  place-content: center;
  aspect-ratio: 1;
  color: white;
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(255, 255, 255, .22) 42% 45%, transparent 45%),
    var(--purple);
  border: 5px solid var(--pink);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--purple);
  text-align: center;
}

.profile-mark span {
  font: 700 22px/.9 var(--display);
  font-style: italic;
}

.profile-mark small {
  margin-top: 10px;
  font: 9px/1.25 var(--ui);
  letter-spacing: .14em;
}

.profile-main {
  align-self: center;
  min-width: 0;
}

.path,
.detail-path {
  margin: 0 0 8px;
  color: var(--purple);
  font: 10px/1.3 var(--ui);
  letter-spacing: .08em;
}

.profile h1 {
  margin: 0;
  color: var(--purple);
  font: 600 clamp(28px, 4.2vw, 56px)/.92 var(--display);
  letter-spacing: -.045em;
}

.profile h1 em {
  color: #ed74ad;
  font-weight: 400;
}

.principle {
  margin: 14px 0 4px;
  font-size: clamp(15px, 1.55vw, 21px);
  font-weight: 700;
}

.profile-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.profile-stats {
  display: flex;
  align-self: start;
  margin: 10px 0 0;
}

.profile-stats div {
  min-width: 98px;
  padding: 0 18px;
  border-left: 1px solid var(--line);
  text-align: center;
}

.profile-stats dt {
  color: var(--purple);
  font: 700 28px/1 var(--display);
}

.profile-stats dd {
  margin: 5px 0 0;
  color: var(--muted);
  font: 9px/1.25 var(--ui);
  letter-spacing: .08em;
}

.profile-status {
  position: absolute;
  right: 30px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line);
  font: 9px/1.3 var(--ui);
}

.profile-status b,
.profile-status small {
  display: block;
}

.profile-status small {
  margin-top: 2px;
  color: var(--muted);
}

.status-light {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  background: var(--lime);
  border: 1px solid #4d5a27;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(118, 146, 47, .5);
}

.explorer {
  padding: 0 30px 32px;
}

.explorer-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  min-height: 74px;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.explorer-toolbar h2 {
  margin: 0 0 13px;
  color: var(--purple);
  font: 700 13px/1 var(--ui);
  letter-spacing: .1em;
}

.explorer-toolbar > p {
  justify-self: end;
  margin: 0 0 13px;
  color: var(--muted);
  font: 10px/1 var(--ui);
}

.view-tabs {
  display: flex;
  align-self: stretch;
}

.view-tabs button {
  position: relative;
  min-width: 92px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font: 10px/1 var(--ui);
  letter-spacing: .08em;
  cursor: pointer;
}

.view-tabs button::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 4px;
  content: "";
  background: transparent;
}

.view-tabs button:hover,
.view-tabs button:focus-visible,
.view-tabs button.is-active {
  color: var(--purple);
  outline: none;
}

.view-tabs button:focus-visible {
  box-shadow: inset 0 0 0 2px var(--purple);
}

.view-tabs button.is-active::after {
  background: var(--pink);
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 16px;
}

.reference-card {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 1.28;
  overflow: hidden;
  padding: 0;
  color: white;
  background: var(--purple);
  border: 2px solid var(--chrome-light);
  outline: 1px solid var(--chrome-dark);
  cursor: pointer;
  text-align: left;
  box-shadow: 5px 5px 0 rgba(61, 0, 91, .13);
  transition: transform 160ms ease, outline-color 160ms ease, box-shadow 160ms ease;
}

.reference-card[hidden] {
  display: none;
}

.reference-card::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, transparent 30%, rgba(16, 5, 20, .1) 50%, rgba(16, 5, 20, .92));
  pointer-events: none;
}

.reference-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(.87) contrast(1.02);
  transform: scale(1.02);
  transition: filter 180ms ease, transform 260ms ease;
}

.reference-card:nth-child(1) img,
.reference-card:nth-child(2) img,
.reference-card:nth-child(3) img {
  object-position: 16% center;
}

.reference-card:nth-child(4) img,
.reference-card:nth-child(5) img,
.reference-card:nth-child(6) img {
  object-position: 19% center;
}

.reference-card:hover,
.reference-card:focus-visible {
  z-index: 2;
  outline: 4px solid var(--pink);
  outline-offset: -4px;
  box-shadow: 7px 7px 0 rgba(61, 0, 91, .24);
  transform: translate(-2px, -2px);
}

.reference-card:hover img,
.reference-card:focus-visible img {
  filter: saturate(1) contrast(1.04);
  transform: scale(1.06);
}

.card-no,
.card-open,
.card-meta {
  position: relative;
  z-index: 1;
}

.card-no {
  align-self: start;
  justify-self: start;
  margin: 10px;
  padding: 6px 8px;
  color: var(--purple);
  background: var(--pink);
  font: 800 11px/1 var(--ui);
  box-shadow: 2px 2px 0 rgba(61, 0, 91, .6);
}

.card-open {
  position: absolute;
  top: 13px;
  right: 12px;
  padding: 5px 7px;
  color: var(--purple);
  background: rgba(255, 250, 252, .9);
  font: 9px/1 var(--ui);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.reference-card:hover .card-open,
.reference-card:focus-visible .card-open {
  opacity: 1;
  transform: translateY(0);
}

.card-meta {
  align-self: end;
  display: grid;
  gap: 4px;
  padding: 22px 12px 11px;
}

.card-meta b {
  font: 700 clamp(13px, 1.2vw, 18px)/1 var(--display);
  letter-spacing: -.01em;
}

.card-meta small {
  color: rgba(255, 255, 255, .72);
  font: 8px/1 var(--ui);
  letter-spacing: .08em;
}

.dock {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--chrome);
  border-top: 2px solid var(--chrome-light);
  box-shadow: inset 0 2px var(--chrome-mid);
}

.dock a {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  place-content: center;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border-right: 1px solid var(--chrome-mid);
  font-family: var(--ui);
}

.dock a:last-child {
  border-right: 0;
}

.dock a span {
  color: var(--purple);
  font-size: 20px;
}

.dock a b {
  font-size: 9px;
  letter-spacing: .08em;
}

.dock a:hover,
.dock a:focus-visible,
.dock a.is-current {
  color: var(--purple);
  background: var(--pink);
  outline: none;
}

.dock a.is-current::before {
  position: absolute;
  top: 0;
  right: 9%;
  left: 9%;
  height: 3px;
  content: "";
  background: var(--purple);
}

.reference-dialog {
  width: min(1100px, calc(100vw - 48px));
  max-width: none;
  height: min(760px, calc(100vh - 48px));
  max-height: none;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--chrome);
  border: 2px solid var(--chrome-light);
  border-right-color: var(--chrome-dark);
  border-bottom-color: var(--chrome-dark);
  box-shadow: 20px 30px 90px rgba(0, 0, 0, .75);
}

.reference-dialog::backdrop {
  background: rgba(13, 4, 17, .78);
  backdrop-filter: blur(5px);
}

.detail-window {
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  height: 100%;
}

.detail-title-bar {
  padding-left: 12px;
}

.detail-title-bar p {
  margin: 0;
}

.detail-title-bar button {
  align-self: stretch;
  width: 46px;
  color: var(--ink);
  background: var(--chrome);
  border: 2px solid var(--chrome-light);
  border-right-color: var(--chrome-dark);
  border-bottom-color: var(--chrome-dark);
  font: 700 24px/1 var(--ui);
  cursor: pointer;
}

.detail-title-bar button:focus-visible,
.detail-title-bar button:hover {
  color: white;
  background: #b02342;
  outline: 2px solid white;
  outline-offset: -5px;
}

.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr);
  gap: 0;
  min-height: 0;
  margin: 8px;
  overflow: hidden;
  background: var(--paper);
  border: 2px solid var(--chrome-dark);
  border-right-color: var(--chrome-light);
  border-bottom-color: var(--chrome-light);
}

.detail-body figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 16px;
  background: #cfc7cd;
  border-right: 1px solid var(--line);
}

.detail-body figure img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: white;
  border: 1px solid var(--chrome-dark);
  box-shadow: 5px 6px 0 rgba(61, 0, 91, .16);
}

.detail-body figcaption {
  margin-top: 12px;
  color: var(--muted);
  font: 8px/1 var(--ui);
  letter-spacing: .08em;
}

.detail-copy {
  min-height: 0;
  overflow: auto;
  padding: clamp(24px, 4vw, 48px) clamp(22px, 3vw, 38px);
}

.detail-copy h2 {
  margin: 0;
  color: var(--purple);
  font: 500 clamp(34px, 5vw, 65px)/.95 var(--display);
  letter-spacing: -.04em;
}

.detail-summary {
  margin: 24px 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.75;
}

.rule-box {
  padding: 16px;
  background: rgba(255, 176, 215, .22);
  border-left: 5px solid var(--pink);
}

.rule-box span {
  color: var(--purple);
  font: 700 9px/1 var(--ui);
  letter-spacing: .1em;
}

.rule-box p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.detail-copy dl {
  margin: 24px 0;
  border-top: 1px solid var(--line);
}

.detail-copy dl div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font: 9px/1.4 var(--ui);
}

.detail-copy dt {
  color: var(--muted);
}

.detail-copy dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-copy > a {
  display: flex;
  justify-content: space-between;
  padding: 13px 14px;
  color: white;
  background: var(--purple);
  text-decoration: none;
  font: 10px/1 var(--ui);
  letter-spacing: .06em;
}

.detail-copy > a:hover,
.detail-copy > a:focus-visible {
  color: var(--purple);
  background: var(--pink);
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .desktop {
    display: block;
    min-height: 100svh;
    padding: 0;
  }

  .desktop-copy,
  .desktop-note {
    display: none;
  }

  .app-window {
    width: 100%;
    height: 100svh;
    min-height: 560px;
    border: 0;
    box-shadow: none;
    grid-template-rows: 36px 36px minmax(0, 1fr) 58px;
  }

  .menu-bar {
    gap: 18px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .profile {
    grid-template-columns: 92px 1fr;
    gap: 18px;
    min-height: 0;
    padding: 22px 20px 65px;
  }

  .profile-mark {
    width: 88px;
  }

  .profile-mark span {
    font-size: 16px;
  }

  .profile-mark small {
    font-size: 7px;
  }

  .profile-stats {
    grid-column: 1 / -1;
    margin: 6px 0 0;
  }

  .profile-stats div {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
  }

  .profile-status {
    right: 20px;
    bottom: 14px;
    left: 20px;
  }

  .explorer {
    padding: 0 16px 24px;
  }

  .explorer-toolbar {
    grid-template-columns: 1fr auto;
    min-height: 62px;
  }

  .explorer-toolbar > p {
    display: none;
  }

  .view-tabs button {
    min-width: 72px;
    padding: 0 6px;
  }

  .reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .reference-card {
    aspect-ratio: .9;
  }

  .reference-card img {
    object-position: 18% center;
  }

  .dock a {
    grid-template-columns: 1fr;
    gap: 2px;
    text-align: center;
  }

  .dock a span {
    font-size: 17px;
  }

  .dock a b {
    font-size: 7px;
  }

  .reference-dialog {
    width: 100vw;
    height: 100svh;
    margin: 0;
    border: 0;
  }

  .detail-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .detail-body figure {
    min-height: 52vw;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-body figure img {
    aspect-ratio: 16 / 9;
  }

  .detail-copy {
    overflow: visible;
  }
}

@media (max-width: 520px) {
  .window-actions span {
    width: 30px;
  }

  .menu-bar a:nth-child(3),
  .menu-bar a:nth-child(4) {
    display: none;
  }

  .profile {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    padding-inline: 15px;
  }

  .profile-mark {
    width: 68px;
  }

  .profile-copy {
    font-size: 12px;
  }

  .explorer-toolbar {
    display: block;
    padding-top: 14px;
  }

  .explorer-toolbar h2 {
    margin-bottom: 10px;
  }

  .view-tabs {
    height: 38px;
    border-top: 1px solid var(--line);
  }

  .view-tabs button {
    flex: 1;
  }

  .reference-grid {
    grid-template-columns: 1fr 1fr;
  }

  .card-meta b {
    font-size: 13px;
  }

  .card-meta small {
    font-size: 7px;
  }

  .card-open {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
