* { margin:0; padding:0; box-sizing:border-box; }

:root {
  --cream: #fff8ec;
  --paper: #fffcf6;
  --sand: #d6c4a5;
  --ink: #384539;
  --muted: #606e5c;
  --sage: #a7bea0;
  --edge: #9da98d;
  --pixel-shadow: 3px 4px 0 #c5b99d, 0 10px 25px #35473618;
}

body {
  background: #fff8ec;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
  cursor: none;
}

#c { display:block; width:100vw; height:100dvh; touch-action: manipulation; }

/* ── CUSTOM CURSOR ── */
#cur {
  width: 24px; height: 24px;
  background: url('cursor.png') no-repeat center center;
  background-size: contain;
  position:fixed; top:0; left:0;
  pointer-events:none; z-index:9999;
  /* Adjust translation to align the pointing finger to the actual cursor coordinate */
  transform: translate(-6px, -2px);
  transition: transform 0.1s;
}
#cur.hovering {
  transform: translate(-6px, -2px) scale(1.15);
  filter: drop-shadow(0 0 5px rgba(255, 208, 128, 0.8));
}

/* ── SCANLINES ── */
#scanlines {
  position:fixed; inset:0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 2px,
    rgba(0,0,0,0.028) 2px, rgba(0,0,0,0.028) 4px
  );
  pointer-events:none; z-index:800;
}

/* ── DITHER VIGNETTE ── */
#vignette {
  position:fixed; inset:0;
  background: radial-gradient(ellipse at center,
    transparent 48%, rgba(20,28,21,0.25) 100%);
  pointer-events:none; z-index:801;
}

/* ── LIGHT POP TRANSITION OVERLAY ── */
#light-pop {
  position: fixed;
  inset: 0;
  background: #fffdf7;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
}

/* ── RETRO GAME LOADER ── */
#loader {
  position: fixed; inset: 0;
  background: #fff8ec;
  z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transition: transform 0.45s cubic-bezier(0.77, 0, 0.175, 1);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
}

#loader.slide-up {
  transform: translateY(-100%);
  pointer-events: none;
}

.loader-scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.25),
    rgba(0, 0, 0, 0.25) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 2;
  opacity: 0.8;
}

.loader-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(10, 7, 4, 0.85) 90%);
  pointer-events: none;
  z-index: 2;
}

.loader-container {
  position: relative;
  z-index: 3;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 18px;
  width: min(90vw, 540px);
  padding: 20px;
}

.loader-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(30, 22, 14, 0.85);
  border: 1px solid #5a4220;
  padding: 5px 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #c8a870;
  letter-spacing: 2px;
  box-shadow: 2px 2px 0 #000;
}

.loader-badge-dot {
  width: 6px; height: 6px;
  background: #00ff88;
  box-shadow: 0 0 6px #00ff88;
  animation: dotBlink 1s infinite alternate;
}
@keyframes dotBlink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

.loader-game-box {
  position: relative;
  width: 100%;
  background: rgba(22, 16, 11, 0.94);
  border: 2px solid #5a4220;
  padding: 24px 28px;
  box-shadow:
    0 0 0 2px #1f1408,
    5px 5px 0 #000,
    0 0 40px rgba(0, 0, 0, 0.7);
  display: flex; flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loader-game-box .corner {
  position: absolute;
  font-family: monospace;
  font-size: 14px;
  color: #c8a870;
  line-height: 1;
}
.loader-game-box .corner.tl { top: 6px; left: 8px; }
.loader-game-box .corner.tr { top: 6px; right: 8px; }
.loader-game-box .corner.bl { bottom: 6px; left: 8px; }
.loader-game-box .corner.br { bottom: 6px; right: 8px; }

/* Pixel Spinner */
.loader-sprite-wrap {
  display: flex; justify-content: center; align-items: center;
  height: 28px;
}

.pixel-spinner {
  display: grid;
  grid-template-columns: repeat(2, 8px);
  grid-gap: 3px;
  animation: spinnerRotate 1.2s infinite steps(4);
}

.spin-block {
  width: 8px; height: 8px;
  background: #46684f;
  box-shadow: 0 0 6px rgba(255, 208, 128, 0.5);
}
.spin-block.b1 { opacity: 1; }
.spin-block.b2 { opacity: 0.7; }
.spin-block.b3 { opacity: 0.2; }
.spin-block.b4 { opacity: 0.45; }

@keyframes spinnerRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Status Text */
.loader-status {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: #46684f;
  letter-spacing: 2px;
  display: flex; align-items: center; gap: 8px;
  min-height: 26px;
  text-shadow: 0 0 8px rgba(255, 208, 128, 0.4);
}

.status-prefix {
  color: #ff9900;
  font-weight: bold;
}

.cursor-blink {
  animation: cursorBlink 0.6s infinite alternate;
  color: #46684f;
}
@keyframes cursorBlink {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Progress bar */
.loader-progress-wrap {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
}

.loader-bar-frame {
  flex: 1;
  height: 22px;
  background: #110d08;
  border: 2px solid #46684f;
  padding: 3px;
  box-shadow:
    inset 0 0 8px rgba(0, 0, 0, 0.9),
    0 0 10px rgba(255, 208, 128, 0.25);
  position: relative;
}

.loader-bar-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: repeating-linear-gradient(
    90deg,
    #46684f 0px,
    #46684f 8px,
    #d49d3b 8px,
    #d49d3b 11px
  );
  box-shadow: 0 0 12px rgba(255, 208, 128, 0.5);
  transition: transform 0.16s ease-out;
}

.loader-pct-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: #46684f;
  min-width: 52px;
  text-align: right;
  text-shadow: 0 0 8px rgba(255, 208, 128, 0.4);
}

.loader-stats {
  width: 100%;
  display: flex; justify-content: space-between;
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: #8c7048;
  letter-spacing: 1px;
}

.loader-fps-tag {
  color: #00dd77;
}

.loader-tip-box {
  display: flex; align-items: center; gap: 8px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #b89868;
  background: rgba(20, 14, 9, 0.7);
  padding: 8px 14px;
  border-left: 3px solid #d49d3b;
  width: 100%;
  letter-spacing: 1px;
}

.loader-tip-tag {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #46684f;
}

/* Shown only by the watchdog when the 3D module never boots. */
#loader.stalled { cursor: auto; }
#loader-retry {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: #fff6dc;
  background: #51695b;
  border: 2px solid #384539;
  box-shadow: 3px 4px 0 #c5b99d;
  padding: 12px 22px;
  cursor: pointer;
}
#loader-retry:hover { background: #384539; }
#loader-retry[hidden] { display: none; }

/* ── MAIN MENU ── */
#menu {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
  padding-left: clamp(28px, 6vw, 110px);
  z-index: 600;
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#menu::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(19, 29, 24, .68), rgba(19, 29, 24, .18) 37%, transparent 65%);
  pointer-events: none;
  z-index: -1;
}

#menu.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#menu.pop-in {
  animation: menuSmoothAppear 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes menuSmoothAppear {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.menu-title {
  font-size: clamp(28px, 3.6vw, 46px);
  color: #46684f;
  text-shadow:
    4px 4px 0 #3d2a10,
    0 0 40px rgba(255, 208, 128, 0.5),
    0 0 80px rgba(255, 208, 128, 0.2);
  letter-spacing: 3px;
  margin-bottom: 12px;
  animation: titleFloat 3s ease-in-out infinite;
}
@keyframes titleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.menu-subtitle {
  font-family: 'Pixelify Sans', 'Fredoka', cursive, sans-serif;
  font-size: clamp(18px, 2.4vw, 25px);
  font-weight: 600;
  color: #fff6dc;
  letter-spacing: 2px;
  margin-bottom: 48px;
  text-shadow:
    2px 2px 0 #3d2a10,
    0 0 20px rgba(255, 208, 128, 0.45);
  animation: subtitlePulse 2.5s ease-in-out infinite alternate;
}
@keyframes subtitlePulse {
  0% { opacity: 0.85; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(-2px); text-shadow: 2px 2px 0 #3d2a10, 0 0 28px rgba(255, 208, 128, 0.7); }
}

.menu-items {
  display:flex; flex-direction:column;
  gap: 12px; align-items:flex-start;
  background: rgba(255,248,236,0.97);
  border: 3px solid #b6ab8e;
  padding: 24px 30px;
  box-shadow:
    0 0 0 1px #d6c4a5,
    6px 6px 0 #c6b798,
    0 0 60px rgba(255,208,128,0.05);
  position:relative;
}
.menu-items::before {
  content:'';
  position:absolute; top:-3px; left:-3px; right:-3px; bottom:-3px;
  border: 1px solid rgba(255,208,128,0.15);
}

.menu-item {
  font-family: inherit;
  background: transparent;
  text-align: left;
  font-size: 11px;
  color: #4e6354;
  padding: 10px 16px;
  cursor: none;
  letter-spacing: 2px;
  transition: color .1s, background .1s;
  display:flex; align-items:center; gap:14px;
  width:100%;
  border: 2px solid transparent;
  position:relative;
}
.menu-item .arrow { opacity:0; transition: opacity .1s; color:#46684f; }
.menu-item:hover {
  color: #46684f;
  background: rgba(255,208,128,0.08);
  border-color: rgba(255,208,128,0.25);
  text-shadow: 0 0 12px rgba(255,208,128,0.5);
}
.menu-item:hover .arrow { opacity:1; }
.menu-item:focus-visible .arrow { opacity: 1; }
button:focus-visible, a:focus-visible { outline: 2px solid #fff6dc; outline-offset: 5px; }
.menu-item:hover #cur { background:#ffdd00; }

.menu-item.primary {
  color: #fff6dc;
  background: rgba(255, 208, 128, 0.08);
  border-color: rgba(255, 208, 128, 0.4);
  box-shadow: 0 0 20px rgba(255, 208, 128, 0.12);
}
.menu-item.primary .arrow {
  opacity: 1;
  animation: arrowPulse 1s ease-in-out infinite alternate;
}
@keyframes arrowPulse {
  0% { transform: translateX(0); opacity: 0.6; }
  100% { transform: translateX(4px); opacity: 1; text-shadow: 0 0 8px #46684f; }
}


.menu-item.disabled {
  color: #5a4a30;
  pointer-events: none;
  opacity: 0.5;
}
.menu-item.disabled:hover {
  background: none;
  border-color: transparent;
  text-shadow: none;
  color: #5a4a30;
}
.coming-soon {
  font-size: 6px;
  color: #5a4a28;
  border: 1px solid #5a4a28;
  padding: 2px 6px;
  margin-left: auto;
  letter-spacing: 1px;
}

.menu-corner {
  position:absolute;
  font-family:'VT323',monospace;
  font-size:14px;
  color:#b6ab8e;
}
.menu-corner.tl { top:8px; left:12px; }
.menu-corner.br { bottom:8px; right:12px; }

/* press any key */
.press-key {
  margin-top:32px;
  font-family:'VT323',monospace;
  font-size:18px;
  color:#75825f;
  letter-spacing:3px;
  animation: blink 1.4s step-end infinite;
}
@keyframes blink { 50%{opacity:0} }

/* ── HUD (shown in world) ── */
#hud {
  position:fixed; z-index:700;
  opacity:0; pointer-events:none;
  transition:opacity .6s;
}

/* bottom hint bar */
#hint-bar {
  bottom:86px; left:50%;
  transform:translateX(-50%);
  background:rgba(255,248,236,0.92);
  border:3px solid #b6ab8e;
  padding:10px 24px;
  box-shadow: 4px 4px 0 #c6b798;
  white-space:nowrap;
}

#room-nav {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 5px;
  background: #fff8ec;
  border: 1px solid #8b7958;
  pointer-events: auto;
}
#room-nav[hidden] { display: none; }
#room-nav button {
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: #425b48;
  font: 18px 'VT323', monospace;
  cursor: none;
  transition: background .15s, color .15s;
}
#room-nav button:hover, #room-nav button:focus-visible { background: #3c5042; color: #fff1d1; }
#hint-text { font-family:'VT323',monospace; font-size:18px; color:#4e6354; letter-spacing:.3px; }

/* back button */
#back-btn {
  top:24px; right:24px;
  background:rgba(255,248,236,0.92);
  border:3px solid #b6ab8e;
  padding:10px 20px;
  font: 16px 'VT323', monospace; color:#4e6354;
  min-height: 44px;
  cursor:none;
  box-shadow: 4px 4px 0 #c6b798;
  transition:color .1s,border-color .1s;
  display:none;
  pointer-events: auto;
}
#back-btn:hover { color:#46684f; border-color:#46684f; }

/* help button (bottom-left) */
#help-btn {
  bottom:24px; left:24px;
  background:rgba(255,248,236,0.92);
  border:3px solid #b6ab8e;
  width:44px; height:44px;
  font-family:'Press Start 2P', monospace;
  font-size:16px; color:#46684f;
  cursor:none;
  box-shadow: 4px 4px 0 #c6b798;
  transition:color .1s, border-color .1s, transform .1s, box-shadow .1s;
  display:none;
  align-items:center;
  justify-content:center;
  pointer-events: auto;
}
#help-btn:hover {
  color:#ffffff;
  border-color:#46684f;
  box-shadow: 0 0 12px rgba(255,208,128,0.5), 4px 4px 0 #c6b798;
  transform: translateY(-2px);
}

/* ── MODAL PANEL ── */
#modal {
  position:fixed; inset:0;
  z-index:750;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,0.7);
  opacity:0; pointer-events:none;
  transition:opacity .4s;
}
#modal.open { opacity:1; pointer-events:all; }

#modal-box {
  background:#fff8ec;
  border:4px solid #46684f;
  box-shadow:
    8px 8px 0 #c6b798,
    0 0 60px rgba(255,208,128,0.12);
  padding:0;
  max-width:700px; width:90%;
  max-height:80vh;
  overflow:hidden;
  transform:translateY(20px);
  transition:transform .4s;
  display:flex; flex-direction:column;
}
#modal.open #modal-box { transform:translateY(0); }

#modal-header {
  background:#fffcf6;
  border-bottom:4px solid #b6ab8e;
  padding:16px 24px;
  display:flex; justify-content:space-between; align-items:center;
}
#modal-title { font-size:10px; color:#46684f; text-shadow:0 0 8px rgba(255,208,128,0.4); }
#modal-close {
  width: 32px;
  height: 32px;
  background: #e81123;
  border: 3px solid #000;
  box-shadow: inset -2px -2px 0px #880011, inset 2px 2px 0px #ff6677;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  padding: 0;
  transition: background 0.1s, box-shadow 0.1s;
  flex-shrink: 0;
}
#modal-close:hover {
  background: #ff2a3a;
  box-shadow: inset -2px -2px 0px #aa0018, inset 2px 2px 0px #ff99aa;
}
#modal-close:active {
  box-shadow: inset 2px 2px 0px #aa0018, inset -2px -2px 0px #ff99aa;
}

.pixel-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 12px;
  width: 24px;
  height: 24px;
  fill: #46684f;
  shape-rendering: crispEdges;
}

#modal-body {
  padding:28px;
  overflow-y:auto;
  flex:1;
}
#modal-body::-webkit-scrollbar { width:8px; }
#modal-body::-webkit-scrollbar-track { background:#fff8ec; }
#modal-body::-webkit-scrollbar-thumb { background:#b6ab8e; border:2px solid #fff8ec; }

/* ── OBJECT LABEL (tooltip) ── */
#obj-label {
  position:fixed;
  background:rgba(255,248,236,0.95);
  border:2px solid #46684f;
  padding:6px 12px;
  font-size:7px;
  color:#46684f;
  pointer-events:none;
  z-index:710;
  opacity:0;
  transition:opacity .2s;
  box-shadow:3px 3px 0 #c6b798;
  white-space:nowrap;
  display: flex;
  align-items: center;
}
#obj-label .pixel-icon {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  display: inline-block;
  vertical-align: middle;
  fill: #46684f;
  shape-rendering: crispEdges;
}


/* ── PROJECT CARD ROW (name left | image right) ── */
.proj-card-row {
  display:flex;
  align-items:stretch;
  gap:16px;
  background:#fffcf6;
  border:3px solid #d6c4a5;
  padding:20px;
  margin-bottom:16px;
  box-shadow:4px 4px 0 #c6b798;
  transition:border-color .15s;
  cursor:none;
}
.proj-card-row:hover { border-color:#46684f; }

.proj-card-info {
  flex:35;
  min-width:0;
}
.proj-card-img {
  flex:65;
  min-width:0;
  display:flex;
  align-items:center;
  overflow:hidden;
  border:2px solid #d6c4a5;
  background:#fff8ec;
}
.proj-card-img img {
  width:100%;
  height:100%;
  object-fit:cover;
  opacity:0.85;
  transition:opacity .2s;
  image-rendering: auto;
}
.proj-card-row:hover .proj-card-img img { opacity:1; }

.proj-tag {
  display:inline-block;
  font-size:6px; padding:3px 8px;
  background:rgba(255,208,128,0.1);
  border:2px solid #46684f;
  color:#46684f; margin-bottom:10px;
}
.proj-name { font-size:10px; color:#344b3e; margin-bottom:8px; line-height: 1.5; }
.proj-desc { font-family:'VT323',monospace; font-size:17px; color:#63735e; line-height:1.5; }
.proj-tech { display:flex; gap:6px; flex-wrap:wrap; margin-top:12px; }
.tech-chip { font-size:6px; padding:3px 7px; background:#fff8ec; border:2px solid #b6ab8e; color:#63735e; }

@media (max-width: 768px) {
  .proj-card-row {
    flex-direction: column;
    padding: 14px;
    gap: 14px;
  }
  .proj-card-img {
    order: 1;
    flex: none;
    width: 100%;
    height: clamp(140px, 45vw, 220px);
    justify-content: center;
  }
  .proj-card-info {
    order: 2;
    flex: none;
    width: 100%;
  }
}

/* ── NEW CONTACT & SOCIALS GRID (COMPACT NON-SCROLLABLE FOR CONTACT PAGE ONLY) ── */
#modal-box.contact-modal-compact {
  max-width: 660px;
  width: 90vw;
}
.contact-modal-compact .contact-grid {
  gap: 12px;
  padding: 4px 0;
}
.contact-modal-compact .contact-box {
  width: 105px;
  height: 105px;
  max-width: 105px;
  max-height: 105px;
  margin: 0 auto;
  border-radius: 6px;
}
.contact-modal-compact .contact-handle {
  font-size: 15px;
  margin-top: 6px;
}
.contact-modal-compact .contact-email-wrapper {
  align-items: center;
  padding-top: 0;
}
.contact-modal-compact .contact-email-card {
  padding: 10px 16px;
  gap: 12px;
  border-radius: 12px;
}
.contact-modal-compact .contact-box.email-box {
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  max-height: 42px;
  border-radius: 8px;
}
.contact-modal-compact .contact-box.email-box svg {
  width: 24px;
  height: 24px;
}
.contact-modal-compact .contact-email-text {
  font-size: 16px;
}

/* ── CONTACT MODAL WIDE — large icons, no scroll ── */
#modal-box.contact-modal-wide {
  max-width: 800px;
  width: 92vw;
  max-height: 85vh;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 10px 0;
}
.contact-grid-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: none;
}
.contact-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fffcf6;
  border: 3px solid #d6c4a5;
  box-shadow: 4px 4px 0 #c6b798;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.contact-grid-card:hover .contact-box {
  border-color: #46684f;
  transform: translateY(-3px);
  box-shadow: 4px 7px 0 #c6b798, 0 0 12px rgba(255, 208, 128, 0.2);
}
.contact-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: transform 0.15s, filter 0.15s;
}
.contact-grid-card:hover .contact-box img {
  transform: scale(1.06);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}
.contact-box svg {
  width: 48%;
  height: 48%;
  transition: transform 0.15s, filter 0.15s;
}
.contact-grid-card:hover .contact-box svg {
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}
.contact-handle {
  font-family: 'VT323', monospace;
  font-size: 19px;
  color: #46684f;
  margin-top: 10px;
  text-align: center;
  word-break: break-all;
}

/* Individual Brand Color Accents & Backgrounds */
.contact-grid-card.instagram .contact-box {
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
  border-color: #d6249f;
}
.contact-grid-card.instagram svg { color: #ffffff; }

.contact-grid-card.github .contact-box {
  background: #181717;
  border-color: #444444;
}
.contact-grid-card.github svg { color: #ffffff; }

.contact-grid-card.linkedin .contact-box {
  background: #0077b5;
  border-color: #005582;
}
.contact-grid-card.linkedin svg { color: #ffffff; }

.contact-grid-card.youtube .contact-box {
  background: #ff0000;
  border-color: #cc0000;
}
.contact-grid-card.youtube svg { color: #ffffff; }

/* Email Card spans columns 2 & 3 in row 2 */
.contact-email-wrapper {
  grid-column: span 2;
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  cursor: none;
}
.contact-email-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fffcf6;
  border: 3px solid #ea4335;
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 4px 4px 0 #c6b798;
  width: 100%;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.contact-email-wrapper:hover .contact-email-card {
  border-color: #46684f;
  transform: translateY(-3px);
  box-shadow: 4px 7px 0 #c6b798, 0 0 12px rgba(255, 208, 128, 0.2);
}
.contact-box.email-box {
  width: 60px;
  height: 60px;
  min-width: 60px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: #ea4335;
  border: 2px solid #b31404;
  box-shadow: none;
}
.contact-box.email-box svg {
  width: 32px;
  height: 32px;
  color: #ffffff;
}
.contact-email-text {
  font-family: 'VT323', monospace;
  font-size: 21px;
  color: #46684f;
  word-break: break-all;
}

@media (max-width: 600px) {
  .contact-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .contact-email-wrapper {
    grid-column: span 2;
  }
}

.about-text { font-family:'VT323',monospace; font-size:19px; color:#b0945c; line-height:1.8; }
.about-text .hl { color:#46684f; }
.stat-row-m { margin:16px 0; }
.stat-label-m { font-size:7px; color:#63735e; margin-bottom:6px; display:flex; justify-content:space-between; }
.stat-bar-m { height:10px; background:#fff8ec; border:2px solid #d6c4a5; }
.stat-fill-m { height:100%; background:#46684f; box-shadow:0 0 6px rgba(255,208,128,0.5); }

/* pixel noise overlay */
#noise {
  position:fixed; inset:0; z-index:802;
  pointer-events:none;
  opacity:.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ── WIDE MODAL MODIFIER FOR SKILL TREE ── */
#modal-box.st-modal-wide {
  max-width: 1150px;
  width: 95vw;
  max-height: 90vh;
}

/* ── SKILL TREE (RPG RADIAL NETWORK WITH PAN & ZOOM) ── */
.st-viewport {
  position: relative;
  width: 100%;
  height: 640px;
  max-height: 78vh;
  background: #f5f0e3;
  border: 3px solid #d6c4a5;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  user-select: none;
  cursor: grab;
}
.st-viewport:active {
  cursor: grabbing;
}

/* Background Constellation / Grid Effect */
.st-bg-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(255, 208, 128, 0.05) 0%, transparent 65%),
    linear-gradient(to right, rgba(58, 42, 20, 0.15) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(58, 42, 20, 0.15) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  z-index: 1;
}

/* Controls Overlay HUD Bar (Bottom-Right) */
.st-hud-bottom-bar {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 50;
}
.st-hud-hint {
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: #687261;
  background: rgba(18, 13, 9, 0.9);
  border: 2px solid #d6c4a5;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  box-shadow: 3px 3px 0 #c6b798;
}
.st-hud-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.st-hud-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #46684f;
  background: #fffcf6;
  border: 2px solid #b6ab8e;
  padding: 7px 10px;
  cursor: pointer;
  box-shadow: 2px 2px 0 #c6b798;
  transition: all 0.15s ease;
}
.st-hud-btn:hover {
  background: #d6c4a5;
  border-color: #46684f;
  color: #ffffff;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .st-hud-hint { display: none; }
}

/* Floating Detail Panel (Top-Left HUD) */
.st-detail-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 270px;
  background: rgba(255,248,236,0.92);
  border: 3px solid #b6ab8e;
  box-shadow: 4px 4px 0 #c6b798, 0 0 20px rgba(0, 0, 0, 0.8);
  padding: 14px;
  z-index: 50;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.st-dp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid #d6c4a5;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.st-dp-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: #fffcf6;
  border: 2px solid #46684f;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(255, 208, 128, 0.3);
}
.st-dp-icon svg {
  width: 22px;
  height: 22px;
}
.st-dp-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: #46684f;
  line-height: 1.4;
}
.st-dp-sub {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: #687261;
  margin-top: 2px;
}
.st-dp-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.st-dp-desc {
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: #4e5f51;
  line-height: 1.35;
  margin: 0;
}

/* Transformable World Canvas */
.st-canvas-world {
  position: absolute;
  width: 2400px;
  height: 2400px;
  transform-origin: 0 0;
  will-change: transform;
}
.st-svg-connections {
  position: absolute;
  top: 0;
  left: 0;
  width: 2400px;
  height: 2400px;
  pointer-events: none;
  z-index: 2;
}
.st-nodes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 2400px;
  height: 2400px;
  z-index: 10;
}

/* Individual Skill Nodes */
.st-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.st-node:hover, .st-node.active {
  transform: translate(-50%, -50%) scale(1.22);
  z-index: 20;
}
.st-node-inner {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fffcf6;
  border: 3px solid #75825f;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.9), inset 0 0 6px rgba(0, 0, 0, 0.6);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.st-node-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.st-node-icon svg {
  width: 100%;
  height: 100%;
}
.st-node-label {
  position: absolute;
  top: 64px;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #344b3e;
  text-align: center;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #000;
  background: rgba(18, 13, 9, 0.9);
  padding: 4px 7px;
  border: 1px solid #d6c4a5;
  pointer-events: none;
  box-shadow: 2px 2px 0 #c6b798;
}

/* Category Specific Node Styling & Glowing States */
.st-node.category-core .st-node-inner {
  width: 78px;
  height: 78px;
  background: radial-gradient(circle, #d6c4a5 0%, #fff8ec 100%);
  border: 4px solid #46684f;
  box-shadow: 0 0 20px rgba(255, 208, 128, 0.6), inset 0 0 10px rgba(255, 208, 128, 0.3);
}
.st-node.category-core .st-node-label {
  top: 84px;
  font-size: 9px;
  color: #46684f;
  border-color: #46684f;
}

.st-node.st-node-root .st-node-inner {
  width: 66px;
  height: 66px;
  border-width: 3.5px;
}

/* Tech category nodes */
.st-node.category-tech .st-node-inner {
  border-color: #4a90e2;
}
.st-node.category-tech:hover .st-node-inner,
.st-node.category-tech.active .st-node-inner {
  border-color: #70b0ff;
  box-shadow: 0 0 18px rgba(74, 144, 226, 0.8), inset 0 0 8px rgba(74, 144, 226, 0.4);
}

/* Soft skills category nodes */
.st-node.category-soft .st-node-inner {
  border-color: #ffaa33;
}
.st-node.category-soft:hover .st-node-inner,
.st-node.category-soft.active .st-node-inner {
  border-color: #ffdd66;
  box-shadow: 0 0 18px rgba(255, 170, 51, 0.8), inset 0 0 8px rgba(255, 170, 51, 0.4);
}

/* Hobby category nodes */
.st-node.category-hobby .st-node-inner {
  border-color: #e06699;
}
.st-node.category-hobby:hover .st-node-inner,
.st-node.category-hobby.active .st-node-inner {
  border-color: #ff88cc;
  box-shadow: 0 0 18px rgba(224, 102, 153, 0.8), inset 0 0 8px rgba(224, 102, 153, 0.4);
}

/* ── EXPERIENCE CARDS (image top | details bottom) ── */
.exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  padding-bottom: 20px;
}
.exp-card {
  background: #fffcf6;
  border: 3px solid #d6c4a5;
  box-shadow: 4px 4px 0 #c6b798;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
  cursor: none;
}
.exp-card:hover {
  border-color: #46684f;
}
.exp-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  border-bottom: 3px solid #d6c4a5;
  background: #f4ead5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.exp-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.2s;
}
.exp-card:hover .exp-card-img img {
  transform: scale(1.03);
}
.exp-card-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.exp-card-tag {
  align-self: flex-start;
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  border: 1px solid #46684f;
  color: #46684f;
  padding: 3px 6px;
  background: rgba(255, 208, 128, 0.1);
}
.exp-card-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #46684f;
  margin-top: 6px;
  line-height: 1.6;
}
.exp-card-subtitle {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: #687261;
  margin-top: 4px;
}
.exp-card-desc {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: #4e5f51;
  margin-top: 6px;
  line-height: 1.4;
}

/* ── ABOUT ME & PROJECT MODAL WIDE STYLING ── */
#modal-box.about-modal-wide,
#modal-box.proj-modal-wide {
  max-width: 940px;
  width: 92vw;
  max-height: 85vh;
}

.about-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  padding: 8px 2px;
}

@media (max-width: 768px) {
  .about-container {
    grid-template-columns: 1fr;
  }
}

.about-hero-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: stretch;
}

.about-avatar-box {
  background: #fffcf6;
  border: 2px solid #d6c4a5;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.about-avatar-photo {
  width: 100%;
  max-width: 200px;
  height: 200px;
  object-fit: cover;
  object-position: center top;
  border-radius: 8px;
  border: 3px solid #4a3825;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6), 0 0 0 1px #ffd08033;
  flex-shrink: 0;
  display: block;
}

.about-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #46684f;
  margin-top: 12px;
  letter-spacing: 1px;
}

.about-role {
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: #687261;
  margin-top: 4px;
}

.about-stats-card {
  background: #fffcf6;
  border: 2px solid #d6c4a5;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  justify-content: space-evenly;
}

.about-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-family: 'VT323', monospace;
  font-size: 19px;
  border-bottom: 1px dashed #2d2113;
  padding: 8px 0;
  gap: 8px;
}
.about-stat-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.stat-key {
  color: #8a7458;
  min-width: 80px;
  flex-shrink: 0;
  padding-top: 1px;
}

.stat-val {
  color: #46684f;
  text-align: right;
}

.stat-val.status-active {
  color: #446a48;
}

/* Download CV Button */
.about-cv-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffaa33;
  color: #f5f0e3;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 12px 14px;
  border: 2px solid #46684f;
  border-radius: 6px;
  text-decoration: none;
  box-shadow: 0 4px 0 #995500;
  transition: all 0.15s ease;
  cursor: pointer;
  margin-top: 2px;
}

.about-cv-btn:hover {
  background: #ffbb44;
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #995500, 0 0 12px rgba(255, 208, 128, 0.4);
}

.about-cv-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #995500;
}

.about-cv-btn svg {
  width: 16px;
  height: 16px;
}

/* Details Column */
.about-details-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.about-section {
  background: #fffcf6;
  border: 2px solid #d6c4a5;
  border-radius: 8px;
  padding: 14px 16px;
}

.about-sec-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #46684f;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.about-sec-title svg {
  width: 15px;
  height: 15px;
}

.about-bio {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #4e5f51;
  line-height: 1.5;
  margin-bottom: 8px;
}
.about-bio:last-child {
  margin-bottom: 0;
}
.about-bio .hl {
  color: #46684f;
}

.about-tags-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.about-tag {
  font-family: 'VT323', monospace;
  font-size: 15px;
  background: #2a1e12;
  color: #ffaa55;
  border: 1px solid #4a3825;
  padding: 3px 8px;
  border-radius: 4px;
}

.about-socials {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.about-social-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'VT323', monospace;
  font-size: 15px;
  background: #241a10;
  color: #46684f;
  border: 1px solid #d6c4a5;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.about-social-link:hover {
  background: #d6c4a5;
  color: #ffffff;
  border-color: #46684f;
  transform: translateY(-2px);
}

.about-social-link svg {
  width: 15px;
  height: 15px;
}



/* Keep the house visible above the menu on portrait screens. */
@media (max-width: 700px) and (orientation: portrait) {
  #menu { justify-content: flex-end; align-items: center; padding: 24px 20px max(32px, env(safe-area-inset-bottom)); }
  #menu::after { background: linear-gradient(0deg, rgba(19,29,24,.9), rgba(19,29,24,.45) 40%, transparent 70%); }
  .menu-title { font-size: clamp(24px, 8vw, 34px); margin-bottom: 8px; }
  .menu-subtitle { font-size: 18px; letter-spacing: .4px; margin-bottom: 22px; }
  .menu-items { width: min(100%, 340px); padding: 16px 20px; gap: 5px; }
  .menu-item { min-height: 44px; font-size: 11px; letter-spacing: .5px; }
  #back-btn { top: 16px; right: 14px; padding: 12px; min-height: 44px; }
  #hint-bar { bottom: 82px; padding: 8px 10px; border-width: 1px; }
  #hint-text { font: 15px 'VT323', monospace; }
  #room-nav { width: calc(100vw - 28px); justify-content: space-between; gap: 0; bottom: max(20px, env(safe-area-inset-bottom)); }
  #room-nav button { padding: 8px 9px; font-size: 16px; }
  #help-btn { bottom: 142px; left: 14px; min-width: 44px; min-height: 44px; }
}
@media (max-height: 570px) and (orientation: landscape) {
  #menu { padding-left: 28px; }
  .menu-title { font-size: 28px; }
  .menu-subtitle { font-size: 18px; margin-bottom: 14px; }
  .menu-items { padding: 12px 20px; gap: 2px; }
  .menu-item { min-height: 44px; font-size: 11px; padding: 9px 12px; }
  #hint-bar { display: none !important; }
}
@media (pointer: coarse) {
  #cur, #obj-label, #noise { display: none; }
  body, button, #room-nav button, .menu-item { cursor: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  #menu, #hud { transition: opacity .16s; }
  #loader { transition: opacity .16s; }
  #loader.slide-up { opacity: 0; transform: none; }
  #cur { transition: none; }
}

/* The AC is a scene object; its HTML target also makes it keyboard accessible. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#ac-access {
  position: fixed; z-index: 701; width: 76px; height: 48px;
  transform: translate(-50%, -50%); background: transparent; color: transparent;
  border: 1px solid transparent; font: 18px 'VT323', monospace; cursor: none;
}
#ac-access:focus-visible, #ac-access[data-edge="true"] {
  background: #252c25; color: #ffe6a3; border-color: #82734e;
}
#ac-access[data-edge="true"] { width: 48px; }
#ac-access[hidden], #abstraction-controls[hidden] { display: none; }

/* A physical service keypad, in the room's existing warm pixel vocabulary. */
#ac-keypad {
  margin: auto; width: min(352px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; overflow-y: auto; overscroll-behavior: contain;
  background: #c7c7b4; color: #202c27; border: 0; border-radius: 8px;
  box-shadow: 0 24px 70px #070c0bb3, inset 0 2px 0 #f4f0d9;
  font-family: 'VT323', monospace; cursor: auto;
}
#ac-keypad::backdrop { background: #0b1215a6; }
body:has(#ac-keypad[open]) #cur, body:has(#ac-keypad[open]) #obj-label { visibility: hidden; }
.ac-panel { padding: 24px; }
.ac-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ac-heading h2 { font: 27px 'VT323', monospace; }
.ac-close {
  display: grid; place-items: center; width: 44px; height: 44px; margin: -8px -8px -8px 0;
  border: 0; background: transparent; color: #303b31; cursor: pointer;
}
.ac-close:hover { background: #b3b5a3; }
.ac-close svg, .ac-keys svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ac-vents { height: 13px; margin: 15px 0 22px; background: repeating-linear-gradient(0deg, #858c7d 0 1px, transparent 1px 4px); }
.ac-readout { background: #243f36; color: #cbecb9; padding: 17px 16px 13px; border: 2px solid #636e5f; border-radius: 3px; }
.ac-readout-label { font-size: 14px; letter-spacing: 1.2px; }
#ac-digits { display: block; margin: 13px 0 10px; font-size: 35px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
#ac-status { min-height: 20px; font-size: 17px; }
.rejected .ac-readout { background: #54232b; color: #ffd2ba; }
.ac-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.ac-keys button {
  display: grid; place-items: center; min-height: 52px; border: 0; border-radius: 4px;
  background: #eeead8; color: #283c32; font: 29px 'VT323', monospace;
  box-shadow: 0 3px 2px #7b8374; cursor: pointer;
}
.ac-keys button:hover { background: #fffbdf; }
.ac-keys button:active { transform: translateY(2px); box-shadow: 0 1px 1px #7b8374; }
#ac-submit {
  width: 100%; min-height: 46px; margin-top: 20px; border: 0; border-radius: 3px;
  background: #324b3d; color: #f1e9cb; font: 19px 'VT323', monospace; cursor: pointer;
}
#ac-submit:hover:enabled { background: #cbdfb8; color: #2f4a36; }
#ac-submit:disabled { background: #a3ab98; color: #364330; cursor: default; }
#ac-keypad button:focus-visible { outline: 3px solid #815223; outline-offset: 3px; }
#ac-instruction { margin-top: 15px; color: #3d4b3d; font-size: 16px; text-align: center; }
#ac-keypad ::selection { background: #385541; color: #f7f0ce; }

/* The corruption is persistent; the large messages only punctuate the shift. */
#abstraction-overlay {
  --ruin: 0; position: fixed; inset: 0; z-index: 805; pointer-events: none;
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 24px;
  background: radial-gradient(ellipse at center, transparent 38%, rgb(36 0 12 / calc(var(--ruin) * .35)) 100%);
}
.abstracted #abstraction-overlay { display: flex; }
#abstraction-message {
  position: relative; max-width: calc(100vw - 40px); padding: 18px 24px;
  color: #f3c7c2; background: #12080ddd; text-align: center; text-wrap: balance;
  font: clamp(16px, 2.1vw, 30px)/1.7 'Press Start 2P', monospace;
  letter-spacing: .06em; opacity: 0; transform: translateY(8px);
  transition: opacity .4s, transform .4s;
}
.show-message #abstraction-message { opacity: 1; transform: translateY(0); }
.abstraction-caption { font: 18px 'VT323', monospace; color: #c88787; opacity: 0; transition: opacity .8s; }
.show-message .abstraction-caption { opacity: 1; }
#abstraction-controls {
  position: fixed; right: 20px; bottom: 24px; z-index: 810; display: flex; gap: 8px;
}
#abstraction-controls button {
  min-height: 44px; padding: 9px 13px; border: 1px solid #70404d; border-radius: 2px;
  background: #210f18; color: #e8c2b8; font: 17px 'VT323', monospace; cursor: pointer;
}
#abstraction-controls button:hover { background: #4b202f; color: #fff1e1; }
#abstraction-controls button:focus-visible { outline-color: #eac4bb; }
#asset-credit {
  position: fixed; left: 18px; top: 24px; z-index: 811; max-width: min(360px, calc(100vw - 36px));
  margin: 0; color: #d8aca7; font: 12px/1.35 'VT323', monospace; opacity: .72;
  text-shadow: 1px 1px 0 #16070d; pointer-events: auto;
}
#asset-credit a { color: #efc5b7; text-underline-offset: 3px; }
#asset-credit a:hover, #asset-credit a:focus-visible { color: #fff0da; }
#asset-credit[hidden] { display: none; }
.abstracted #light-pop { background: #090409; }
.abstracted #loc-box, .abstracted #hint-bar, .abstracted #room-nav, .abstracted #back-btn, .abstracted #help-btn {
  background: #1e101bea; border-color: #593040; color: #dda69f;
}
.abstracted #loc-name, .abstracted #hint-text { color: #e9b0a9; }
.abstracted #loc-sub { color: #c88e91; }
.abstracted #room-nav button { color: #e2b2ad; }
.abstracted #room-nav button:hover, .abstracted #room-nav button:focus-visible { background: #4b2435; color: #ffddd0; }
.abstracted #obj-label { border-color: #9e4755; background: #200b18; color: #ffc4b1; }
.abstracted #menu::after { background: linear-gradient(90deg, #140611b8, #14061130 48%, transparent 75%); }
.abstracted .menu-title {
  max-width: 760px; font-size: clamp(25px, 3.8vw, 52px); line-height: 1.5;
  letter-spacing: -.02em; color: #f0b9b0; text-shadow: 3px 1px 0 #6d1843, -2px 0 0 #39676c;
  animation: none; text-wrap: balance;
}
.abstracted .menu-subtitle { color: #daa19e; text-shadow: 1px 2px 4px #17030c; animation: none; }
.abstracted .menu-items { background: #1e0c18eb; border-color: #623147; box-shadow: 5px 10px 40px #0d0308a6; }
.abstracted .menu-items::before { border-color: #87455b50; }
.abstracted .menu-item { color: #cda5a2; }
.abstracted .menu-item.primary { color: #f0c5ba; background: #743a4526; border-color: #ad677780; box-shadow: none; }
.abstracted .menu-item:hover { background: #7a344333; border-color: #bf7a86; color: #ffe1d5; text-shadow: none; }
.abstracted .menu-item .arrow { color: #e8a1ab; animation: none; }
.glitch-burst #loc-name, .glitch-burst #hint-text, .glitch-burst .menu-title,
.glitch-burst #abstraction-message { text-shadow: 4px 0 #da1762, -4px 1px #48c8c2; }
.glitch-burst #abstraction-message::after {
  content: attr(data-text); position: absolute; inset: 0; padding: inherit;
  color: #e48bba; transform: translateX(-5px); clip-path: inset(37% 0 42% 0);
}
@media (max-width: 1050px) {
  #abstraction-controls { bottom: 140px; right: 14px; gap: 6px; }
  #abstraction-controls button { font-size: 16px; padding: 8px 10px; }
  #asset-credit { left: 14px; top: 92px; bottom: auto; max-width: 245px; font-size: 11px; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .abstracted .menu-title { max-width: 350px; font-size: clamp(23px, 7vw, 33px); }
  .abstracted .menu-subtitle { font-size: 18px; letter-spacing: 0; }
  .abstracted #menu::after { background: linear-gradient(0deg, #150712ed, #15071260 55%, transparent 80%); }
  .abstracted #loc-name { max-width: 160px; font-size: 9px; line-height: 1.5; }
  .abstracted #loc-sub { max-width: 150px; font-size: 15px; }
  .abstracted[data-scene="OUTSIDE"] #abstraction-controls { top: 16px; bottom: auto; }
  #abstraction-message { padding: 16px; font-size: 16px; }
}
@media (max-height: 620px) {
  .ac-panel { padding: 16px 22px; }
  .ac-vents { margin: 9px 0; height: 9px; }
  .ac-readout { padding: 10px 14px; }
  #ac-digits { margin: 8px 0; font-size: 28px; }
  .ac-keys { margin-top: 12px; gap: 7px; }
  .ac-keys button { min-height: 44px; }
  #ac-submit { margin-top: 12px; }
  #ac-instruction { margin-top: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  #abstraction-message { transform: none; transition: opacity .3s; }
  .abstracted .menu-title, .glitch-burst #abstraction-message { text-shadow: none; }
}


/* Cozy pixel studio: cream paper, little keepsakes, and tactile game controls. */
::selection { background: #d4e4c4; color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid #477861; outline-offset: 5px; }
.pixel-art { width: 32px; height: 32px; display: inline-block; flex-shrink: 0; vertical-align: middle; image-rendering: pixelated; shape-rendering: crispEdges; }
#scanlines { z-index: 600; opacity: .45; }
#vignette { z-index: 601; opacity: .45; }
#noise { z-index: 602; opacity: .025; }
#cur.hovering { filter: drop-shadow(1px 2px 1px #65867555); }
#menu .menu-title { color: #fff7dd; text-shadow: 3px 3px 0 #485b47, 0 5px 20px #34433e38; }
#menu .menu-subtitle { color: #fff7dd; text-shadow: 1px 2px 2px #34433e; animation: none; letter-spacing: .5px; }
.menu-items { border: 2px solid var(--edge); box-shadow: var(--pixel-shadow); padding: 20px; gap: 4px; }
.menu-items::before { border-color: #fff; pointer-events: none; }
.menu-item { color: var(--ink); letter-spacing: .5px; font-size: 10px; min-height: 56px; gap: 16px; }
.menu-item .arrow { opacity: 1; display: flex; }
.menu-item.primary, .menu-item.primary:hover { color: #324e3c; background: #e1ebd3; border-color: #b1c397; box-shadow: none; }
.menu-item.primary .arrow { animation: none; }
.menu-item:hover { color: #324e3c; background: #f0e7d2; border-color: #d2c5a5; text-shadow: none; }
.menu-corner { display: none; }
#loader { box-shadow: none; color: var(--ink); }
.loader-scanlines, .loader-vignette { opacity: .04; }
.loader-game-box, .loader-badge, .loader-tip-box { background: var(--paper); color: var(--ink); border-color: var(--sand); box-shadow: var(--pixel-shadow); }
.loader-status, #loader-status-text, .loader-stats, .loader-tip-text, .loader-badge { color: var(--muted); text-shadow: none; }
.loader-bar-fill { background: var(--sage); box-shadow: none; }
.loader-pct-badge { background: #dce8cc; color: var(--ink); border-color: var(--edge); }
.loader-bar-frame { background: #eee5d0; border-color: var(--sand); box-shadow: inset 1px 2px #d9ceb6; }
.loader-fps-tag, .loader-game-box .corner { color: #63735e; }
.loader-badge-dot { background: #789d6c; box-shadow: none; }
.loader-badge { font: 15px 'Pixelify Sans', sans-serif; letter-spacing: 1px; }
.loader-tip-box { border: 1px solid var(--sand); }
.loader-tip-tag { font-size: 10px; }
.loader-stats { flex-wrap: wrap; gap: 8px; }
#room-nav { background: var(--cream); border: 2px solid var(--edge); padding: 6px 12px; gap: 8px; box-shadow: var(--pixel-shadow); bottom: max(18px, env(safe-area-inset-bottom)); }
#room-nav button { display: flex; position: relative; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; font: 19px 'Pixelify Sans', sans-serif; color: var(--ink); border: 1px solid transparent; transition: background .15s, transform .15s; }
#room-nav button:hover, #room-nav button:focus-visible { background: #e3ebd7; color: #324e3c; border-color: #c2ceac; }
#room-nav .pixel-art { width: 32px; height: 32px; }
#room-nav .nav-check { width: 16px; height: 16px; position: absolute; top: -5px; right: -2px; background: var(--cream); }
#back-btn, #help-btn { background: var(--cream); border: 2px solid var(--edge); color: var(--ink); box-shadow: var(--pixel-shadow); }
#back-btn { font: 20px 'Pixelify Sans', sans-serif; padding: 8px 16px; min-height: 52px; }
#back-btn .pixel-art { width: 28px; height: 28px; margin-right: 8px; }
#back-btn:hover, #help-btn:hover { background: #e4edd9; border-color: #7e9b75; color: var(--ink); box-shadow: var(--pixel-shadow); }
#help-btn { width: 56px; height: 56px; justify-content: center; align-items: center; }
#help-btn .pixel-art { width: 36px; height: 36px; }
#hint-bar { bottom: 98px; padding: 8px 16px; background: #fff8ecee; border: 1px solid var(--sand); box-shadow: 0 3px 10px #35473615; max-width: calc(100vw - 36px); white-space: normal; text-align: center; }
#hint-text { font: 18px 'Pixelify Sans', sans-serif; color: #52634c; line-height: 1.35; }
#obj-label { background: var(--cream); color: var(--ink); border-color: var(--edge); box-shadow: var(--pixel-shadow); font: 16px 'Pixelify Sans', sans-serif; padding: 8px 12px; }
#obj-label .pixel-art { width: 24px; height: 24px; margin-right: 7px; }
#modal { background: #26392c45; z-index: 900; padding: 64px 24px 28px; }
#modal-box, #modal-box.proj-modal-wide, #modal-box.about-modal-wide, #modal-box.contact-modal-wide, #modal-box.st-modal-wide { position: relative; background: var(--cream); width: min(1120px, 94vw); max-width: 1120px; max-height: calc(100dvh - 100px); border: 3px solid var(--edge); box-shadow: 5px 6px 0 #c4b99d, 0 20px 70px #20372735; overflow: visible; }
#modal-box { width: min(820px, 94vw); }
#modal-header { flex-shrink: 0; min-height: 55px; padding: 0; background: transparent; border: 0; position: relative; }
#modal-title { position: absolute; top: -39px; left: 24px; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 105px); min-height: 76px; color: var(--ink); text-shadow: none; font: 700 48px/1 'Pixelify Sans', sans-serif; }
.modal-emblem { width: 80px; height: 80px; display: grid; place-items: center; flex-shrink: 0; background: transparent; }
.modal-emblem .pixel-art { width: 80px; height: 80px; filter: drop-shadow(2px 3px 0 #d1c7ae); }
.modal-heading-text { background: transparent; padding: 0; text-shadow: -1px -1px 0 var(--cream), 1px -1px 0 var(--cream), -1px 1px 0 var(--cream), 1px 1px 0 var(--cream); }
#modal-close { position: absolute; right: 16px; top: 12px; width: 38px; height: 38px; color: #805446; background: #f0c7b5; border: 2px solid #bd9380; box-shadow: inset 2px 2px #fff0dd, 2px 2px #d5b29a; font: 30px/1 'Pixelify Sans', sans-serif; }
#modal-close:hover { background: #eab19f; box-shadow: inset 2px 2px #ffe1cd, 2px 2px #d5b29a; }
#modal-body { padding: 12px 28px 28px; min-height: 0; scrollbar-color: #a4b28b #f3ebda; scrollbar-width: thin; overscroll-behavior: contain; }
#modal-body::-webkit-scrollbar-track { background: #f3ebda; }
#modal-body::-webkit-scrollbar-thumb { background: #a4b28b; border: 2px solid #f3ebda; }
.menu-intro { color: var(--muted); font: 21px/1.5 'Pixelify Sans', sans-serif; margin: 0 0 24px; max-width: 65ch; }
.proj-card-row { background: var(--paper); padding: 24px; gap: 28px; border: 2px solid var(--sand); box-shadow: 2px 3px 0 #e2d8bf; margin-bottom: 22px; }
.proj-card-row:hover { border-color: #9dab88; }
.proj-card-info { flex: 4; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.proj-card-img { flex: 6; background: #f0ebdf; border: 1px solid #e1d7c1; }
.proj-card-img img { opacity: 1; height: auto; aspect-ratio: 1.8; object-fit: contain; }
.proj-name { font-size: 12px; line-height: 1.8; color: var(--ink); margin-bottom: 12px; }
.proj-desc, .about-bio, .exp-card-desc { font: 18px/1.55 'Pixelify Sans', sans-serif; color: #52614f; max-width: 65ch; }
.proj-tag, .exp-card-tag { color: #66553e; background: #f4e6bd; border: 1px solid #d6c28a; padding: 5px 8px; font: 13px 'Pixelify Sans', sans-serif; }
.proj-tech { gap: 6px; margin-top: 15px; }
.tech-chip, .about-tag { color: #4f6655; background: #eaf0df; border: 1px solid #c8d5b5; font: 13px 'Pixelify Sans', sans-serif; padding: 5px 8px; }
.project-open, .about-cv-btn, #copy-email { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: #dbe8ca; color: #36513d; border: 2px solid #a7bb92; box-shadow: 2px 3px 0 #c0cba8; text-decoration: none; font: 17px 'Pixelify Sans', sans-serif; padding: 9px 14px; min-height: 44px; }
.project-open { margin-top: 22px; }
.project-open:hover, .about-cv-btn:hover, #copy-email:hover { background: #cbdfb8; color: #2f4a36; transform: translateY(-1px); }
.project-open span { font: 21px sans-serif; }
.exp-grid { grid-template-columns: 1fr; gap: 20px; position: relative; padding-left: 30px; }
.exp-grid::before { content: ''; position: absolute; top: 32px; bottom: 32px; left: 12px; width: 1px; background: #c4bd94; }
.exp-marker { position: absolute; left: -34px; top: 22px; background: var(--cream); padding: 3px 0; }
.exp-marker .pixel-art { width: 24px; height: 24px; }
.exp-card { position: relative; display: grid; grid-template-columns: 32% 1fr; background: var(--paper); border: 2px solid var(--sand); box-shadow: 2px 3px #e2d8bf; }
.exp-card-img { height: 100%; aspect-ratio: auto; border: 0; min-height: 190px; background: #efe6d1; }
.exp-card-content { padding: 24px; }
.exp-card-title { color: var(--ink); font-size: 11px; line-height: 1.8; }
.exp-card-subtitle { font: 17px 'Pixelify Sans', sans-serif; color: var(--muted); }
.about-container { grid-template-columns: 260px 1fr; gap: 32px; }
.about-avatar-box, .about-stats-card { background: var(--paper); border-color: var(--sand); box-shadow: 2px 3px #e2d8bf; }
.about-avatar-photo { border-color: #c0cdaa; filter: none; }
.about-name, .about-sec-title { color: var(--ink); text-shadow: none; }
.about-sec-title { font: 18px 'Pixelify Sans', sans-serif; }
.about-name { font-size: 11px; line-height: 1.6; }
.about-avatar-photo { box-shadow: 0 3px 8px #35473618; border-radius: 2px; }
.about-cv-btn:hover { box-shadow: 2px 3px 0 #c0cba8; }
.about-role, .stat-key, .stat-val { color: var(--muted); }
.about-stat-item { border-color: #e7dfcc; }
.about-section .hl { color: #365d46; font-weight: 600; }
.about-sec-title { border-color: #ddd5be; }
.about-sec-title .pixel-art { width: 28px; height: 28px; }
.about-cv-btn .pixel-art { width: 26px; height: 26px; }
.about-quote { margin: 22px 0; padding: 18px 20px; background: #edf0de; }
.about-quote-text { font: 20px/1.5 'Pixelify Sans', sans-serif; color: #4b634d; }
.about-quote-author { font: 15px/1.6 'Pixelify Sans', sans-serif; color: #65715d; margin-top: 8px; }
.about-social-link { color: #465f4c; background: #fffcf6; border-color: var(--sand); box-shadow: none; }
.about-social-link:hover { background: #e5eed8; color: #36513d; border-color: #a7bb92; }
.about-social-link .pixel-art { width: 24px; height: 24px; }
.social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.social-card { display: flex; align-items: center; gap: 18px; padding: 22px; background: var(--paper); border: 2px solid var(--sand); box-shadow: 2px 3px #e2d8bf; text-decoration: none; color: var(--ink); }
.social-card > .pixel-art { width: 56px; height: 56px; }
.social-card strong { display: block; font: 21px 'Pixelify Sans', sans-serif; margin-bottom: 6px; }
.social-card span span { color: var(--muted); font: 16px 'Pixelify Sans', sans-serif; }
.social-card .social-arrow { margin-left: auto; color: #6d835f; font: 24px sans-serif; }
.social-card:hover { border-color: #9bae87; background: #f4f5e8; }
.letter-card { display: flex; align-items: center; gap: 20px; margin-top: 24px; padding: 24px; background: #f4ecd7; border: 2px dashed #cbbb99; }
.letter-card > .pixel-art { width: 64px; height: 64px; }
.letter-label { display: block; margin-bottom: 6px; color: #6b705a; font: 17px 'Pixelify Sans', sans-serif; }
.letter-card a { font: 20px 'Pixelify Sans', sans-serif; color: #405e4a; overflow-wrap: anywhere; text-underline-offset: 4px; }
#copy-email { margin-left: auto; flex-shrink: 0; }
.copy-status { min-height: 24px; margin-top: 12px; font: 17px 'Pixelify Sans', sans-serif; color: #46654b; }
.guide-welcome { display: flex; gap: 18px; padding: 20px; background: #e9eedb; margin-bottom: 24px; }
.guide-welcome .pixel-art { width: 48px; height: 48px; }
.guide-welcome p { font: 23px/1.4 'Pixelify Sans', sans-serif; color: var(--ink); }
.guide-welcome span, .guide-item p { font: 18px/1.5 'Pixelify Sans', sans-serif; color: var(--muted); }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.guide-item { display: flex; align-items: flex-start; gap: 14px; }
.guide-item .pixel-art { width: 40px; height: 40px; }
.guide-item h3 { font: 20px 'Pixelify Sans', sans-serif; color: var(--ink); margin-bottom: 7px; }
.guide-footer { border-top: 1px solid var(--sand); margin-top: 24px; padding-top: 20px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font: 16px 'Pixelify Sans', sans-serif; }
kbd { padding: 4px 7px; border: 1px solid #c0ba9c; box-shadow: 0 2px #d8cfb4; background: var(--paper); color: #506347; font: 14px 'Pixelify Sans', sans-serif; }
#modal-box.st-modal-wide { width: min(1320px, 95vw); max-width: 1320px; }
#modal-box.st-modal-wide #modal-body { overflow: hidden; padding: 6px 18px 18px; }
.st-viewport { height: min(650px, calc(100dvh - 185px)); max-height: none; background: #f3f1e5; border: 2px solid #d1d8bb; box-shadow: inset 0 0 36px #c5ceb726; touch-action: none; }
.st-bg-grid { background-image: linear-gradient(to right, #9aaa8520 1px, transparent 1px), linear-gradient(to bottom, #9aaa8520 1px, transparent 1px); background-size: 32px 32px; }
.st-detail-panel { width: 250px; background: var(--paper); border: 2px solid #c2ccab; box-shadow: 3px 4px #d9dfc9; backdrop-filter: none; }
.st-dp-header { border-color: #e0e3cf; }
.st-dp-icon { border: 0; background: none; box-shadow: none; border-radius: 0; width: 48px; height: 48px; }
.st-dp-icon svg { width: 48px; height: 48px; }
.st-dp-title { color: var(--ink); }
.st-dp-sub, .st-dp-desc { font-family: 'Pixelify Sans', sans-serif; color: var(--muted); }
.st-dp-desc { font-size: 16px; line-height: 1.45; }
.st-node { border: 0; background: none; padding: 0; }
.st-node-inner, .st-node.category-core .st-node-inner { border-radius: 12px; background: #fffbee; border: 2px solid #b3bf96; box-shadow: 3px 4px #cad3b6; }
.st-node.category-core .st-node-inner { background: #f8e6ad; border-color: #baaa6a; }
.st-node-icon { width: 38px; height: 38px; }
.st-node-core .st-node-icon { width: 48px; height: 48px; }
.st-node-label, .st-node.category-core .st-node-label { background: var(--paper); border: 1px solid #cbd3b8; box-shadow: 1px 2px #dde1cd; color: #44593d; text-shadow: none; font: 14px 'Pixelify Sans', sans-serif; padding: 3px 7px; }
.st-node.category-tech .st-node-inner { border-color: #86b4c1; background: #edf5f3; }
.st-node.category-soft .st-node-inner { border-color: #c5ad6a; background: #fff5d9; }
.st-node.category-hobby .st-node-inner { border-color: #c49bb1; background: #fff1f3; }
.st-node:hover, .st-node.active { transform: translate(-50%, -50%) scale(1.1); }
.st-node:hover .st-node-inner, .st-node.active .st-node-inner { box-shadow: 3px 4px #bdc8a8, 0 0 0 5px #fffdf3; }
.st-hud-hint { color: var(--muted); background: var(--cream); border: 1px solid var(--sand); box-shadow: none; font-family: 'Pixelify Sans', sans-serif; }
.st-hud-btn { background: var(--cream); border-color: #afbd98; color: #4b6345; box-shadow: 2px 2px #ccd4b7; min-width: 40px; min-height: 40px; font: 15px 'Pixelify Sans', sans-serif; }
.st-hud-btn:hover { background: #e0ebcc; color: #36513d; border-color: #92a779; }
#ac-keypad { background: var(--cream); color: var(--ink); border-color: var(--edge); box-shadow: var(--pixel-shadow); }
.ac-panel, .ac-heading { background: var(--cream); }
.ac-readout { background: #e3ebd2; color: #36513d; border-color: #adb994; }
.ac-keys button { background: var(--paper); color: var(--ink); border-color: var(--sand); }
#ac-submit { background: #dbe8ca; color: #36513d; border-color: #a7bb92; }
#ac-submit:disabled { opacity: .5; }
#ac-access:focus-visible, #ac-access[data-edge="true"] { background: var(--cream); color: var(--ink); border-color: var(--edge); }
@media (max-width: 760px) {
  #modal { padding: 58px 10px 16px; }
  #modal-box, #modal-box.proj-modal-wide, #modal-box.about-modal-wide, #modal-box.contact-modal-wide, #modal-box.st-modal-wide { width: 100%; max-height: calc(100dvh - 90px); }
  #modal-title { left: 10px; top: -29px; gap: 8px; font-size: 28px; min-height: 56px; max-width: calc(100% - 62px); }
  .modal-emblem, .modal-emblem .pixel-art { width: 56px; height: 56px; }
  .modal-heading-text { padding-right: 6px; }
  #modal-close { top: 10px; right: 10px; width: 36px; height: 36px; }
  #modal-header { min-height: 52px; }
  #modal-body { padding: 8px 14px 20px; }
  .proj-card-row { padding: 16px; gap: 18px; }
  .proj-card-info { display: block; }
  .proj-card-img { flex: none; }
  .proj-name { font-size: 10px; }
  .proj-desc { font-size: 18px; }
  .proj-card-img img { height: 100%; }
  .about-container { grid-template-columns: 1fr; gap: 24px; }
  .about-avatar-photo { max-width: 180px; }
  .exp-card { grid-template-columns: 1fr; }
  .exp-card-img { aspect-ratio: 16/9; min-height: 0; }
  .social-grid { gap: 12px; }
  .social-card { padding: 14px 10px; flex-direction: column; text-align: center; gap: 8px; }
  .social-card .social-arrow { display: none; }
  .social-card strong { font-size: 19px; }
  .letter-card { flex-wrap: wrap; padding: 16px; gap: 10px; }
  .letter-card > .pixel-art { width: 40px; height: 40px; }
  .letter-card > div { flex: 1; min-width: 0; }
  .letter-card a { font-size: 17px; }
  #copy-email { width: 100%; margin-top: 6px; }
  .guide-grid { grid-template-columns: 1fr; gap: 20px; }
  .guide-welcome { padding: 14px; gap: 12px; }
  .guide-welcome .pixel-art { width: 32px; height: 32px; }
  #room-nav { width: calc(100vw - 24px); gap: 0; justify-content: space-around; padding: 5px 3px; bottom: max(14px, env(safe-area-inset-bottom)); }
  #room-nav button { flex-direction: column; gap: 3px; padding: 4px 5px; font-size: 14px; }
  #room-nav .pixel-art { width: 28px; height: 28px; }
  #room-nav .nav-check { width: 12px; height: 12px; }
  #hint-bar { bottom: 94px; padding: 7px 12px; width: max-content; }
  #hint-text { font-size: 15px; }
  #help-btn { bottom: 155px; left: 14px; width: 48px; height: 48px; }
  #back-btn { top: 16px; right: 14px; font-size: 18px; min-height: 46px; }
  #modal-box.st-modal-wide #modal-body { padding: 5px 8px 10px; }
  .st-viewport { height: calc(100dvh - 175px); min-height: 280px; }
  .st-detail-panel { top: 9px; left: 9px; width: calc(100% - 18px); padding: 10px 12px; }
  .st-dp-header { gap: 8px; padding-bottom: 5px; margin-bottom: 5px; }
  .st-dp-icon, .st-dp-icon svg { width: 32px; height: 32px; }
  .st-dp-desc { font-size: 14px; }
  .st-hud-bottom-bar { right: 8px; bottom: 8px; }
  .st-hud-btn { min-height: 44px; }
}
@media (max-height: 570px) and (orientation: landscape) {
  #modal { padding-top: 42px; }
  #modal-box { max-height: calc(100dvh - 66px) !important; }
  .st-viewport { height: calc(100dvh - 152px); min-height: 180px; }
  .st-detail-panel { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* A cream arcade cabinet around a crisp, low-resolution night sky. */
#modal-box.arcade-modal { width: min(850px, 94vw); }
.arcade-layout { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 28px; align-items: center; }
.arcade-console { background: #dae3c9; border: 3px solid #8b9e83; padding: 10px; box-shadow: 5px 5px 0 #bdc7ae; }
.arcade-scoreboard { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 2px 10px; font: 8px/1.8 'Press Start 2P', monospace; color: #405346; }
.arcade-scoreboard strong { display: block; font-size: 11px; }
#arcade-lives { color: #a45255; font: bold 19px/1 monospace; white-space: nowrap; }
.arcade-screen { position: relative; border: 4px solid #40574e; background: #172e38; }
#arcade-canvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; image-rendering: pixelated; touch-action: none; }
.arcade-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; text-align: center; background: #172e38ed; color: #fff4da; }
.arcade-overlay[hidden] { display: none; }
.arcade-badge .pixel-art { width: 68px; height: 68px; }
.arcade-eyebrow { font: 8px/1.8 'Press Start 2P', monospace; letter-spacing: .5px; color: #5e7462; }
.arcade-overlay .arcade-eyebrow { color: #b9d6b9; margin: 16px 0 10px; }
.arcade-overlay h3 { font: 23px/1.5 'Press Start 2P', monospace; color: #ffe1a0; margin: 0; }
.arcade-message { font: 21px/1.2 'VT323', monospace; margin: 14px 0 20px; }
.arcade-layout button, .arcade-launch { border: 2px solid #657b62; background: #f8e6b7; color: #364b3d; min-height: 44px; padding: 12px; box-shadow: 3px 3px 0 #a0af91; font: 9px/1.5 'Press Start 2P', monospace; cursor: pointer; }
.arcade-layout button:hover, .arcade-launch:hover { background: #ffedc8; }
.arcade-layout button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #a0af91; }
.arcade-layout button:disabled { opacity: .5; cursor: default; }
.arcade-controls { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; margin-top: 12px; }
.arcade-controls [data-move] { touch-action: none; user-select: none; font-size: 18px; background: #fff8e9; }

.arcade-guide { display: flex; flex-direction: column; align-items: center; gap: 42px; }
.arcade-record { display: flex; flex-direction: column; align-items: center; gap: 16px; color: #405346; }
.arcade-record .pixel-art { width: 72px; height: 72px; }
.arcade-record span { font: 10px/1.5 'Press Start 2P', monospace; }
.arcade-record strong { font: 700 48px/1 'Pixelify Sans', sans-serif; font-variant-numeric: tabular-nums; }
.arcade-keys { display: flex; gap: 14px; }
.arcade-keys kbd { display: grid; place-items: center; width: 48px; height: 48px; font: 700 28px 'Pixelify Sans', sans-serif; background: #e4e9d8; border: 2px solid #a0af91; box-shadow: 0 3px 0 #a0af91; }
@media (max-width: 600px) {
  #modal-box.arcade-modal { width: 100%; }
  .arcade-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .arcade-console { width: min(100%, 340px); box-sizing: border-box; margin: auto; }

  .arcade-guide { flex-direction: row; justify-content: space-between; gap: 16px; }
  .arcade-record { display: grid; grid-template-columns: 40px auto; column-gap: 10px; row-gap: 6px; }
  .arcade-record .pixel-art { width: 40px; height: 40px; grid-row: span 2; }
  .arcade-record strong { font-size: 28px; }
  .arcade-record span { font-size: 8px; }

  .arcade-overlay h3 { font-size: 20px; }
}
