/* Ink Desk shell — original bright mid-2000s desk-portal look.
   No real brand names, logos, or copied trade dress. */

:root {
  --ink: #1a1040;
  --ink-soft: #3a2a66;
  --paper: #fffdf8;
  --paper-2: #fff3c4;
  --magenta: #ff3d8a;
  --magenta-deep: #c2185b;
  --magenta-dark: #8a1040;
  --cyan: #19d0e0;
  --cyan-deep: #0a8a99;
  --sun: #ffe56a;
  --sun-deep: #e09a00;
  --lime: #9ae22b;
  --lime-deep: #4a8c00;
  --orange: #ff7a18;
  --orange-deep: #c44a00;
  --grape: #7b3cff;
  --grape-deep: #4a1dad;
  --hot: #ff4d6d;
  --online: #1ec96a;
  --online-deep: #0b7a3a;
  --shadow: rgba(26, 16, 64, 0.22);
  --display: "Trebuchet MS", "Arial Black", "Arial Rounded MT Bold", Impact, Tahoma, sans-serif;
  --body: "Trebuchet MS", Tahoma, Verdana, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Lucida Console", Monaco, Consolas, monospace;
  --safe-top: max(12px, env(safe-area-inset-top));
  --safe-bottom: max(12px, env(safe-area-inset-bottom));
  --safe-left: max(12px, env(safe-area-inset-left));
  --safe-right: max(12px, env(safe-area-inset-right));
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
  background-color: #ff5aa8;
  background-image:
    radial-gradient(circle at 3px 3px, rgba(255, 255, 255, 0.92) 1.15px, transparent 1.5px),
    radial-gradient(circle at 14px 16px, #ffe56a 1.25px, transparent 1.7px),
    radial-gradient(circle at 20px 6px, rgba(123, 60, 255, 0.45) 1.1px, transparent 1.5px),
    linear-gradient(180deg, #ff9adf 0%, #ff62b0 42%, #ff8a4a 100%);
  background-size: 24px 24px, 24px 24px, 24px 24px, auto;
  background-attachment: fixed;
}
body { min-height: 100dvh; }

a { color: var(--grape-deep); }
button, .btn {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 800;
  color: #3a1600;
  background: linear-gradient(180deg, #fff4a0 0%, #ffd447 42%, #ff9a14 100%);
  border: 2px solid var(--orange-deep);
  border-radius: 14px;
  padding: 0.58rem 1.15rem;
  cursor: pointer;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.75),
    inset 0 -3px 0 rgba(180, 80, 0, 0.28),
    0 4px 0 var(--orange-deep);
}
button:hover, .btn:hover { filter: brightness(1.06); }
button:active, .btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(180, 80, 0, 0.2),
    0 1px 0 var(--orange-deep);
}
button.ghost, .btn.ghost {
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, #efe8ff 55%, #d9ccff 100%);
  border-color: var(--grape-deep);
  text-shadow: 0 1px 0 #fff;
  box-shadow:
    inset 0 2px 0 #fff,
    inset 0 -3px 0 rgba(74, 29, 173, 0.18),
    0 3px 0 var(--grape-deep);
}
button.rust, .btn.rust {
  color: #fff;
  background: linear-gradient(180deg, #ff8ab3 0%, #ff3d8a 45%, #c2185b 100%);
  border-color: var(--magenta-dark);
  text-shadow: 0 1px 0 rgba(80, 0, 30, 0.35);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -3px 0 rgba(80, 8, 32, 0.28),
    0 4px 0 var(--magenta-dark);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: var(--safe-top) var(--safe-right) 0.55rem var(--safe-left);
  min-height: 58px;
  background: linear-gradient(180deg, #ff8ad4 0%, #ff3d8a 48%, #e01870 100%);
  border-bottom: 4px solid var(--magenta-dark);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 6px 0 rgba(138, 16, 64, 0.25);
}
.topbar h1 {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.03em;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 0 var(--magenta-dark), 0 0 10px rgba(255, 255, 255, 0.35);
}
.topbar .icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffffff, #ffe56a);
  color: var(--ink);
  border: 2px solid var(--magenta-dark);
  border-radius: 12px;
  text-decoration: none;
  font-size: 1.1rem;
  box-shadow:
    inset 0 2px 0 #fff,
    0 3px 0 var(--magenta-dark);
}
.topbar .desk-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  color: var(--online-deep);
  border: 2px solid var(--online-deep);
  border-radius: 999px;
  padding: 0.15rem 0.55rem 0.15rem 0.3rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 0 var(--online-deep);
}
.topbar .desk-chip .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 0 2px #d6ffe4;
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@media (max-width: 520px) {
  .topbar .desk-chip .chip-label { display: none; }
}

.stage-wrap {
  padding: 0.7rem var(--safe-right) var(--safe-bottom) var(--safe-left);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stage {
  position: relative;
  width: min(1100px, 100%);
  background: var(--paper);
  border: 4px solid #fff;
  outline: 4px solid var(--grape-deep);
  border-radius: 18px;
  box-shadow:
    0 0 0 8px rgba(255, 229, 106, 0.55),
    0 16px 0 rgba(74, 29, 173, 0.2),
    0 22px 30px var(--shadow);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 140px);
}
@media (orientation: portrait) and (max-width: 820px) {
  .stage {
    aspect-ratio: 3 / 4;
    max-height: calc(100dvh - 150px);
    width: min(640px, 100%);
  }
}
.stage canvas, .stage .layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.stage .ui-layer {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.stage .ui-layer .hud {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  text-shadow: 0 1px 0 #fff;
}
.hud-card {
  background: rgba(255, 253, 248, 0.92);
  border: 2px solid var(--grape-deep);
  border-radius: 10px;
  padding: 4px 8px;
  box-shadow: 0 2px 0 var(--grape);
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 16, 64, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 5;
}
.overlay.hidden { display: none; }
.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 0 0 1.25rem;
  width: min(420px, 100%);
  text-align: center;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 3px var(--sun),
    0 10px 0 rgba(26, 16, 64, 0.18),
    0 16px 28px var(--shadow);
}
.panel h2 {
  margin: 0 0 0.7rem;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 900;
  font-style: italic;
  color: #fff;
  letter-spacing: 0.03em;
  padding: 0.7rem 1rem 0.75rem;
  background: linear-gradient(180deg, #7b9bff 0%, #7b3cff 48%, #4a1dad 100%);
  text-shadow: 0 2px 0 #2a1070;
  border-bottom: 3px solid #2a1070;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.panel p {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  line-height: 1.35;
  padding: 0 1.15rem;
}
.panel .row,
.panel .diff-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0 1.1rem;
}
.panel .diff-row { margin-bottom: 0.75rem; }
.diff-row button[aria-pressed="true"] {
  outline: 3px solid var(--magenta);
  outline-offset: 1px;
}

.hint {
  margin: 0.65rem auto 0;
  max-width: 720px;
  padding: 0.35rem 0.8rem;
  text-align: center;
  color: #fff;
  font-size: 0.86rem;
  line-height: 1.35;
  text-shadow: 0 1px 0 rgba(80, 0, 40, 0.55);
  background: rgba(26, 16, 64, 0.28);
  border-radius: 999px;
}

/* Home / profile layout */
.sparkle-field {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.sparkle {
  position: absolute;
  width: 14px;
  height: 14px;
  background:
    linear-gradient(90deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
    linear-gradient(0deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
    radial-gradient(circle, #ffe56a 0 28%, transparent 30%);
  opacity: 0.75;
  animation: twinkle 2.6s ease-in-out infinite;
  filter: drop-shadow(0 0 3px #fff);
}
.sparkle:nth-child(2) { animation-delay: 0.7s; width: 10px; height: 10px; }
.sparkle:nth-child(3) { animation-delay: 1.3s; width: 16px; height: 16px; }
.sparkle:nth-child(4) { animation-delay: 1.9s; }
.sparkle:nth-child(5) { animation-delay: 0.4s; width: 11px; height: 11px; }
.sparkle:nth-child(6) { animation-delay: 1.6s; width: 9px; height: 9px; }
@keyframes twinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(20deg); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.home {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 0.8rem) var(--safe-right) calc(var(--safe-bottom) + 2rem) var(--safe-left);
}
.home-hero {
  position: relative;
  text-align: center;
  margin-bottom: 1.1rem;
  padding: 1.15rem 6.5rem 1.15rem 1.2rem;
  color: #fff;
  background: linear-gradient(180deg, #7bb8ff 0%, #4a6bff 22%, #7b3cff 70%, #4a1dad 100%);
  border: 3px solid #fff;
  border-radius: 22px;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.35),
    0 0 0 4px var(--sun),
    0 8px 0 var(--grape-deep);
  overflow: hidden;
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 42%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent);
  pointer-events: none;
}
.home-hero .eyebrow {
  position: relative;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--sun);
  margin: 0 0 0.3rem;
  text-shadow: 0 1px 0 #2a1070;
}
.home-hero h1 {
  position: relative;
  font-family: var(--display);
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  margin: 0 0 0.3rem;
  color: #fff;
  text-shadow:
    0 0 0 #2a1070,
    3px 4px 0 #2a1070,
    0 0 18px rgba(255, 229, 106, 0.55);
}
.home-hero .lede {
  position: relative;
  margin: 0 auto 0.8rem;
  max-width: 38rem;
  color: #f3ecff;
  text-shadow: 0 1px 0 #2a1070;
}
.status-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  border: 2px solid #fff;
  box-shadow: 0 2px 0 rgba(26, 16, 64, 0.35);
}
.badge .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2.4s ease-in-out infinite;
}
.badge.at-desk {
  background: var(--lime);
  color: var(--lime-deep);
  border-color: var(--lime-deep);
}
.badge.mood {
  background: #fff;
  color: var(--magenta-deep);
  border-color: var(--magenta-deep);
}

.starburst {
  position: absolute;
  right: 0.7rem;
  top: 0.55rem;
  z-index: 2;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  text-align: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 0.78rem;
  line-height: 1.05;
  letter-spacing: 0.03em;
  color: #7a1400;
  text-transform: uppercase;
  background: var(--sun);
  clip-path: polygon(
    50% 0%, 61% 18%, 85% 12%, 76% 35%, 100% 50%,
    76% 65%, 85% 88%, 61% 82%, 50% 100%, 39% 82%,
    15% 88%, 24% 65%, 0% 50%, 24% 35%, 15% 12%, 39% 18%
  );
  filter: drop-shadow(0 3px 0 #c44a00);
  transform: rotate(-8deg);
  animation: badge-wobble 3.2s ease-in-out infinite;
}
.starburst span { display: block; font-size: 1.05rem; }
@keyframes badge-wobble {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(-2deg) scale(1.04); }
}
@media (max-width: 640px) {
  .home-hero { padding: 1rem 1rem 1.1rem; }
  .starburst { position: relative; right: auto; top: auto; margin: 0 auto 0.6rem; }
}

.profile-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 820px) {
  .profile-layout { grid-template-columns: 1fr; }
  .faves-box { order: -1; }
}

.box {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.7),
    0 8px 0 rgba(26, 16, 64, 0.16);
}
.box-head {
  margin: 0;
  padding: 0.5rem 0.85rem;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3);
}
.about-box .box-head {
  background: linear-gradient(180deg, #5fe0a0, #1ec96a 55%, #0b7a3a);
  border-bottom: 3px solid #0b7a3a;
}
.faves-box .box-head {
  background: linear-gradient(180deg, #ff9a4a, #ff3d8a 55%, #c2185b);
  border-bottom: 3px solid #8a1040;
}
.notes-box .box-head {
  background: linear-gradient(180deg, #7bdbff, #19d0e0 55%, #0a8a99);
  border-bottom: 3px solid #0a8a99;
}
.box-body { padding: 0.85rem; }

.avatar-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.7rem;
}
.avatar {
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: linear-gradient(160deg, #ffe56a, #ff7a18);
  box-shadow: inset 0 0 0 3px #fff, 0 3px 0 var(--orange-deep);
  overflow: hidden;
}
.avatar-meta strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 900;
}
.avatar-meta .tiny {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.about-box .blurb {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.4;
}
.now-playing {
  margin: 0.7rem 0 0;
  padding: 0.45rem 0.55rem;
  background: #fff3c4;
  border: 2px dashed var(--orange-deep);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}
.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, #ffffff, #fff6d8);
  border: 3px solid var(--ink);
  border-radius: 16px;
  min-height: 210px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 0 #fff,
    0 5px 0 rgba(26, 16, 64, 0.25);
  transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-3px) rotate(-0.4deg); }
.card .thumb {
  height: 118px;
  border-bottom: 3px solid var(--ink);
  position: relative;
}
.card .thumb::after {
  content: "PLAY";
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  font-family: var(--display);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #7a1400;
  background: var(--sun);
  border: 2px solid #7a1400;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  box-shadow: 0 2px 0 #7a1400;
}
.card .body { padding: 0.7rem 0.85rem 0.9rem; }
.card h2 {
  margin: 0 0 0.25rem;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 900;
  font-style: italic;
  color: var(--grape-deep);
}
.card p { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }

.notes-box { margin-top: 1rem; }
.notes-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.notes-list li {
  background: #fff;
  border: 2px solid var(--cyan-deep);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  box-shadow: 3px 3px 0 rgba(25, 208, 224, 0.35);
}
.notes-list .who {
  font-weight: 800;
  color: var(--cyan-deep);
  margin-right: 0.35rem;
}

.foot {
  margin-top: 1.4rem;
  text-align: center;
  font-size: 0.82rem;
  color: #fff;
  text-shadow: 0 1px 0 rgba(80, 0, 40, 0.55);
}

.touch-pad {
  position: absolute;
  inset: auto 0 0 0;
  height: 34%;
  pointer-events: none;
  z-index: 3;
}
.touch-pad button {
  pointer-events: auto;
  position: absolute;
  opacity: 0.82;
  min-width: 56px;
  min-height: 56px;
}
@media (hover: hover) and (pointer: fine) {
  .touch-pad { display: none; }
}

/* Embedded third-party games in the desk chrome */
.stage.stage-embed {
  background: #0e1020;
}
.stage.stage-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.stage.stage-scroll iframe {
  /* allow tall rules/help text to scroll inside the frame */
}
.credit-line a {
  color: #ffe56a;
  font-weight: 800;
}
.credit-line .src-offer {
  display: inline;
}

.credits-page .box { margin-bottom: 1rem; }
.credits-page .box-head {
  background: linear-gradient(180deg, #7bdbff, #19d0e0 55%, #0a8a99);
  border-bottom: 3px solid #0a8a99;
}
.credits-page article {
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  background: #fff;
  border: 2px solid var(--grape-deep);
  border-radius: 12px;
  box-shadow: 3px 3px 0 rgba(123, 60, 255, 0.25);
}
.credits-page article h2 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--grape-deep);
}
.credits-page article p { margin: 0; line-height: 1.45; }
.credits-page article a { font-weight: 800; }
.topbar-spacer { width: 42px; height: 42px; }

/* Coil Yard direction pad — original Ink Desk chrome, shown on touch/phone.
   Placed below the stage so it never covers the play field. */
.dpad {
  display: none;
  position: relative;
  width: 158px;
  height: 158px;
  margin: 0.4rem auto 0.1rem;
  flex-shrink: 0;
}
body.show-dpad .dpad,
body.has-dpad .dpad { display: block; }
@media (hover: hover) and (pointer: fine) {
  body.has-dpad:not(.show-dpad) .dpad { display: none; }
}
body.show-dpad .stage,
body.has-dpad.show-dpad .stage {
  max-height: calc(100dvh - 300px);
}
@media (orientation: portrait) and (max-width: 820px) {
  body.show-dpad .stage {
    max-height: calc(100dvh - 310px);
  }
}
.dpad button {
  position: absolute;
  width: 50px;
  height: 50px;
  min-width: 50px;
  min-height: 50px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, #ffe56a 45%, #ffb020 100%);
  border: 2px solid var(--magenta-dark);
  border-radius: 14px;
  box-shadow:
    inset 0 2px 0 #fff,
    0 3px 0 var(--magenta-dark);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.dpad button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.5),
    0 1px 0 var(--magenta-dark);
}
.dpad .dir-up { top: 0; left: 50%; margin-left: -25px; }
.dpad .dir-down { bottom: 0; left: 50%; margin-left: -25px; }
.dpad .dir-left { left: 0; top: 50%; margin-top: -25px; }
.dpad .dir-right { right: 0; top: 50%; margin-top: -25px; }
