* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --ink: #262126;
  --cream: #faf5e9;
  --red: #bb3826;
  --line: #302a32;
  --page: #f7f3e9;
  --muted: #625964;
  --rule: #c9c2b7;
  --bar: #e9dce9;
  --speech: #fff8e8;
  --field: #fffcf5;
  --field-line: #bfb5a8;
  --thumb: #ebe7dc;
  --focus: #235bb3;
  --selected-text: white;
  --mono: "Courier New", monospace;
  font: 16px/1.45 "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}
[data-theme="dark"] {
  color-scheme: dark;
  --page: #17171c;
  --ink: #f7eee2;
  --cream: #26252e;
  --red: #ff927e;
  --muted: #c2b9c7;
  --rule: #4f4a56;
  --line: #655b6b;
  --bar: #3b3345;
  --speech: #292431;
  --field: #2c2932;
  --field-line: #766d7a;
  --thumb: #38333e;
  --focus: #96ceff;
  --selected-text: #211d24;
}
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; }
button, a { color: inherit; }
button { cursor: pointer; font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.mast, footer { width: min(92%, 1400px); margin-inline: auto; display: flex; justify-content: space-between; align-items: center; }
.mast { min-height: 68px; border-bottom: 1px solid var(--rule); }
.wordmark { font: italic 900 1.95rem/1 Arial, sans-serif; letter-spacing: -.095em; text-decoration: none; }
.wordmark span { color: var(--red); }
.site-header { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; }
.mast-nav { display: flex; align-items: stretch; gap: 3px; border-bottom: 2px solid var(--red); }
.mast-nav a, .mast-nav button {
  display: grid; place-items: center; padding: 9px 13px; min-height: 44px;
  text-decoration: none; text-align: center; color: var(--ink); background: transparent;
  border: 1px solid var(--field-line); border-bottom: 0; border-radius: 7px 7px 0 0;
  font: 600 .95rem/1.2 var(--mono);
}
.mast-nav :is(a, button):hover { background: var(--bar); }
.mast-nav :is(a[aria-current="page"], button[aria-expanded="true"]) { background: var(--red); color: var(--selected-text); border-color: var(--red); }
.mast-nav:has([aria-expanded="true"]) a[aria-current="page"] { background: transparent; color: var(--ink); border-color: var(--field-line); }
@media (max-width: 760px) {
  .site-header { grid-template-columns: 1fr auto; gap: 5px 12px; padding-top: 5px; }
  .site-header .theme-toggle { grid-column: 2; grid-row: 1; }
  .mast-nav { grid-column: 1 / -1; grid-row: 2; }
  .mast-nav a, .mast-nav button { flex: 1 1 auto; padding-inline: 5px; font-size: .875rem; }
}
.theme-toggle { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--field-line); background: var(--field); display: grid; place-items: center; }
.theme-toggle:hover { border-color: var(--red); color: var(--red); }
.theme-toggle span { width: 17px; height: 17px; border-radius: 50%; box-shadow: inset -5px -2px currentColor; }
[data-theme="dark"] .theme-toggle span { width: 12px; height: 12px; border: 1.5px solid currentColor; box-shadow: 0 -9px 0 -5px, 0 9px 0 -5px, 9px 0 0 -5px, -9px 0 0 -5px, 6px 6px 0 -5px, -6px -6px 0 -5px, 6px -6px 0 -5px, -6px 6px 0 -5px; }
main { width: min(92%, 1060px); margin: 0 auto; flex: 1; }
.heading { text-align: center; margin: clamp(24px, 4.2vh, 66px) auto clamp(20px, 3vh, 40px); }
h1 { margin: 0; font: 800 clamp(3.1rem, 7vw, 6.5rem)/1.02 "Segoe UI", Arial, sans-serif; letter-spacing: -.083em; }
h1 em { font: italic 500 1.05em/.95 Georgia, serif; letter-spacing: -.08em; color: var(--red); }
.heading p { margin: .45rem 0 0; font-size: clamp(1rem, 1.45vw, 1.2rem); }
.window { overflow: hidden; border: 2px solid var(--line); border-radius: 13px; box-shadow: 4px 5px 0 var(--line); background: var(--cream); }
.window:has(.window-link) { position: relative; isolation: isolate; }
.window-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.window-link:focus-visible { outline-offset: -4px; }
#poke { position: relative; z-index: 2; }
.bar { display: flex; justify-content: space-between; align-items: center; min-height: 39px; padding: 0 1.15rem; background: var(--bar); border-bottom: 2px solid var(--line); font: bold .9rem var(--mono); }
.file, .online { display: flex; align-items: center; gap: .55rem; }
.file i { display: block; width: 15px; height: 12px; border: 1.5px solid; border-top-width: 4px; border-radius: 1px; }
.online i { width: 9px; height: 9px; border-radius: 50%; background: #5b8a55; border: 1px solid #34542f; }
.habitat {
  position: relative; isolation: isolate; height: clamp(315px, 39vh, 470px);
  background: #a293ba url("window-assets/evening.png") center 64% / cover no-repeat;
  image-rendering: pixelated; border-bottom: 2px solid var(--line);
}
.resident { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); display: flex; align-items: flex-start; justify-content: center; gap: clamp(15px, 2.4vw, 36px); width: 77%; image-rendering: auto; }
#pet { position: relative; border: none; background: transparent; display: grid; place-items: end center; width: clamp(155px, 19vw, 245px); height: clamp(155px, 19vw, 245px); padding: 0; flex-shrink: 0; border-radius: 45%; -webkit-tap-highlight-color: transparent; }
#pet img, #pet canvas { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 4px 0 #44304760); }
#pet canvas { position: absolute; inset: 0; pointer-events: none; }
.bubble { width: min(100%, 285px); position: relative; margin-top: 4px; padding: 12px 17px 16px; border: 2px solid var(--line); border-radius: 13px 13px 13px 3px; background: var(--speech); box-shadow: 3px 3px 0 #342936; }
.bubble::after { content: ""; position: absolute; bottom: 13px; left: -8px; width: 11px; height: 11px; background: var(--speech); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: skewY(-25deg) rotate(18deg); }
.who, .label { font: bold .8rem/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.who { color: var(--red); }
#speech { font-size: clamp(1.05rem, 1.8vw, 1.45rem); font-weight: 650; line-height: 1.24; letter-spacing: -.035em; margin: 4px 0 0; overflow-wrap: anywhere; }
.controls { min-height: 85px; display: grid; align-items: center; grid-template-columns: 1fr auto; gap: clamp(18px, 3.2vw, 52px); padding: 15px clamp(15px, 2.5vw, 30px); }
.label { color: var(--muted); }
.activity { display: grid; gap: 3px; }.activity strong { font-size: clamp(1.15rem, 2vw, 1.55rem); letter-spacing: -.045em; line-height: 1.15; }
.action { background: #d64d34; border: 2px solid var(--line); box-shadow: 2px 3px 0 var(--line); border-radius: 7px; padding: .64rem 1.2rem; color: #170c09; font-weight: 750; font-size: 1.05rem; }
.action span { display: inline-block; font-size: 1.3rem; line-height: 1; margin-left: .35rem; }
.action:hover { background: #ed745a; }.action:active { transform: translate(1px, 2px); box-shadow: 1px 1px 0 var(--line); }
.hint { text-align: center; color: var(--muted); margin: 16px auto 26px; font-size: .95rem; }
footer { border-top: 1px solid var(--rule); min-height: 57px; color: var(--muted); }
footer span { font: .86rem var(--mono); } footer i { font-family: Georgia,serif; }
#bio { background: var(--cream); color: var(--ink); border: 2px solid var(--line); border-radius: 13px; width: min(42rem, 92vw); max-height: 88dvh; overflow: auto; padding: 0; box-shadow: 4px 5px var(--line); }
#bio::backdrop { background: #20192899; }
#bio .bar { position: sticky; top: 0; z-index: 1; padding: 4px 8px 4px 15px; }
.bio-close { display: grid; place-items: center; width: 36px; height: 32px; padding: 0; border: 1px solid var(--field-line); border-radius: 5px; background: var(--field); font: 1.45rem/1 var(--mono); }
.bio-close:hover { background: var(--red); color: var(--selected-text); }
.bio-close:focus-visible { outline-offset: 1px; }
.bio-body { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(0, 2.4fr); grid-template-areas: "sticker heading" "sticker copy"; gap: 10px 24px; padding: clamp(16px, 4vw, 28px); }
.bio-sticker { grid-area: sticker; align-self: center; width: 100%; height: auto; transform: rotate(-4deg); }
#bio-title { grid-area: heading; margin: 0; font-size: clamp(1.45rem, 3.5vw, 2rem); line-height: 1.1; letter-spacing: -.055em; }
.bio-copy { grid-area: copy; }
.bio-copy p { margin: 0; }.bio-copy p + p { margin-top: .8em; }
@media (max-width: 520px) {
  .bio-body { grid-template-columns: 4.5rem minmax(0, 1fr); grid-template-areas: "sticker heading" "copy copy"; gap: 14px; align-items: center; }
}
@media (max-width: 640px) {
  .mast { min-height: 56px; }.heading { margin: 28px auto 20px; }.heading p { max-width: 32ch; margin-inline: auto; }
  .habitat { height: 330px; background-position: 39% center; }
  .resident { width: 94%; height: 95%; bottom: 3%; align-items: center; flex-direction: column-reverse; justify-content: flex-start; gap: 9px; }
  #pet { width: 154px; height: 154px; }
  .bubble { width: min(89%, 255px); margin: 0 0 0 15px; padding: 8px 13px 10px; }
  .bubble::after { left: 40%; bottom: -7px; transform: rotate(-45deg); }
  .controls { grid-template-columns: 1fr auto; gap: 12px; padding: 15px; }
  .action { padding: .55rem .8rem; }
  .hint { max-width: 33ch; }.bar { padding: 0 12px; }
}
@media (max-width: 340px) {
  .action span { display: none; }.action { padding-inline: .5rem; }.controls { column-gap: 6px; }
}
