:root {
  --ink: #1b1d20;
  --mute: #6d7279;
  --line: #d4d7db;
  --chrome: #ececec;
  --aqua: #2fb5d6;
  --aqua-hi: #a8f0ff;
  --win-r: 18px;
  --font: "IBM Plex Sans Thai", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #fff; /* same white as the board's page, so nothing frames it */
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }

/* ---------- the Canva board, exactly as composed ---------- */
/* board fills the full screen width (no side bars); page scrolls when taller than the screen */
.stage {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1588 / 2246;
  user-select: none;
}
.board img { display: block; width: 100%; height: 100%; }
.hot { position: absolute; inset: 0; width: 100%; height: 100%; }

.spot {
  fill: transparent;
  stroke: transparent;
  stroke-width: 6;
  cursor: pointer;
  outline: none;
  transition: stroke .2s, fill .2s;
}
/* nothing drawn over the photos (client request); outline only for keyboard users */
.spot:focus-visible { stroke: var(--aqua-hi); }

/* backlight: blended onto the photo's own black screen, so it reads as the LCD lighting up */
.ipod-screen { pointer-events: none; opacity: 0; transition: opacity .6s; mix-blend-mode: screen; }
.is-playing .ipod-screen { opacity: 1; }
#eq rect { fill: #d6f7ff; opacity: .85; }
.ipod-prog { fill: rgba(214,247,255,.25); }
.ipod-prog-fill { fill: #d6f7ff; }

/* hints: little pulsing rings that say "click me", becoming a check once explored */
.hints { position: absolute; inset: 0; pointer-events: none; }
.hint {
  position: absolute;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--aqua-hi) 40%, var(--aqua) 75%);
  box-shadow: 0 0 0 2px #fff, 0 4px 14px rgba(0,90,120,.45);
  display: grid; place-items: center;
  font: 700 15px var(--mono); color: #064c5e;
  animation: bob 1.6s ease-in-out infinite;
}
.hint::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid var(--aqua-hi);
  animation: ping 1.6s ease-out infinite;
}
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes ping { from { opacity: .9; transform: scale(.7); } to { opacity: 0; transform: scale(1.5); } }

/* ---------- windows ---------- */
.layer { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.win {
  position: absolute;
  width: min(420px, calc(100vw - 24px));
  max-height: min(78svh, 640px);
  display: flex; flex-direction: column;
  background: #fafafa;
  border: 1px solid #c9c9c9;
  border-radius: var(--win-r);
  box-shadow: 0 18px 50px -12px rgba(0,0,0,.35), 0 2px 0 rgba(255,255,255,.8) inset;
  pointer-events: auto;
  transform-origin: var(--ox, 50%) var(--oy, 50%);
  animation: pop .48s cubic-bezier(.2, 1.6, .4, 1) both;
  transition: width .38s cubic-bezier(.25, 1.25, .5, 1), max-height .38s ease, left .38s cubic-bezier(.25, 1.25, .5, 1);
}
.win.is-dragging { transition: none; }
.win__photo { transition: width .38s cubic-bezier(.25, 1.25, .5, 1), height .38s cubic-bezier(.25, 1.25, .5, 1), background-size .38s cubic-bezier(.25, 1.25, .5, 1), background-position .38s cubic-bezier(.25, 1.25, .5, 1); }
.win__text, .pf__grid dd { transition: font-size .38s ease; }
.win[data-size="4"] .win__text, .win[data-size="5"] .win__text, .win[data-size="6"] .win__text { font-size: 17px; }
.win.is-front { border-color: #9fdcec; box-shadow: 0 0 0 3px rgba(168,240,255,.55), 0 22px 60px -12px rgba(0,0,0,.42); }
.win.is-closing { animation: shut .2s ease-in forwards; }
.win.is-min { display: none; }
.win.is-max { left: 12px !important; top: 12px !important; width: calc(100vw - 24px); max-height: calc(100svh - 70px); height: calc(100svh - 70px); }
@keyframes pop { 0% { opacity: 0; transform: scale(.3) rotate(-4deg); } 60% { opacity: 1; } 100% { transform: none; } }
@keyframes shut { to { opacity: 0; transform: scale(.6) translateY(20px); } }

.win__bar {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 60px; padding: 0 16px;
  background: linear-gradient(#f2f2f2, var(--chrome));
  border-bottom: 1px solid var(--line);
  border-radius: var(--win-r) var(--win-r) 0 0;
  cursor: grab; touch-action: none;
}
.win__bar:active { cursor: grabbing; }
.is-front .win__bar { background: linear-gradient(#f7fdff 0%, #e3f6fb 50%, #d3eef6 51%, #e6f7fb 100%); }
.dot {
  width: 28px; height: 28px; padding: 0; border-radius: 50%;
  border: 0; cursor: pointer; position: relative; z-index: 1;
  background: #a9abae;
  box-shadow: inset 0 -3px 4px rgba(0,0,0,.15), 0 1px 0 rgba(255,255,255,.9);
  display: grid; place-items: center; font: 700 17px/1 var(--mono); color: rgba(0,0,0,.42);
  transition: transform .15s, color .15s;
}
.dot:nth-child(2) { background: #d0d1d3; }
.dot:hover { color: rgba(0,0,0,.75); transform: scale(1.08); }
.dot:active { transform: scale(.92); }
.dot:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
.win__title {
  position: absolute; left: 0; right: 0; text-align: center;
  font: 500 19px var(--font); letter-spacing: .01em; pointer-events: none;
}
.win__max {
  margin-left: auto; width: 36px; height: 26px; border-radius: 6px; position: relative; z-index: 1;
  border: 1.5px solid #b9bbbe; background: #f4f4f4; cursor: pointer; padding: 0;
}
.win__max::after { content: ""; position: absolute; inset: 4px; border: 1.5px solid #c9cbce; border-radius: 3px; }
.win__body { overflow: auto; padding: 16px 18px 20px; overscroll-behavior: contain; }
.win__photo {
  max-width: 100%; border: 0; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #d0d0d0, 0 6px 14px -6px rgba(0,0,0,.3);
  margin-left: auto; margin-right: auto;
  background-image: url("assets/board.jpg"); background-repeat: no-repeat;
  margin-bottom: 14px; border-radius: 3px;
}
.win__text { white-space: pre-line; font-size: 15.5px; line-height: 1.75; margin: 0; overflow-wrap: break-word; }
/* profile */
.pf__head { display: grid; justify-items: center; text-align: center; gap: 2px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.pf__label { font: 400 11px var(--mono); letter-spacing: .08em; color: var(--mute); }
.pf__name { font-size: clamp(21px, 6.4vw, 27px); font-weight: 700; line-height: 1.35; white-space: nowrap; }
.pf__latin { font: 400 13px var(--mono); color: var(--mute); display: flex; align-items: center; gap: 8px; }
.pf__chip {
  font: 700 11px var(--mono); font-style: normal; letter-spacing: .08em; color: #0b6077;
  padding: 2px 8px; border-radius: 99px; background: #e3f6fb; border: 1px solid #a9e0ee;
}
.pf__grid { display: grid; grid-template-columns: auto 1fr; margin: 6px 0 0; }
.pf__grid dt, .pf__grid dd { margin: 0; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pf__grid dt { font-size: 13px; color: var(--mute); padding-right: 18px; }
.pf__grid dd { font-size: 15.5px; font-weight: 500; text-align: right; }
.pf__grid dt:nth-last-of-type(1), .pf__grid dd:last-child { border-bottom: 0; }

/* ---------- tabs (open windows) ---------- */
.tabs {
  position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 6px; padding: 6px; z-index: 20000;
  background: rgba(245,245,245,.82); backdrop-filter: blur(10px);
  border: 1px solid #c9c9c9; border-radius: 14px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.35);
  max-width: calc(100vw - 20px); overflow-x: auto; scrollbar-width: none;
}
.tabs:empty { display: none; }
.tab {
  border: 1px solid #cfd1d4; background: #fff; border-radius: 9px;
  padding: 6px 12px; font: 500 14px var(--font); cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.tab::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #b6b8bb; }
.tab.is-front { border-color: #8fd6e8; background: #ecfafe; }
.tab.is-front::before { background: var(--aqua); }
.tab.is-min { opacity: .6; }

/* image credit (client's text) - kept off the photos */
.credit {
  margin: 14px auto 18px;
  font: 400 12px/1.4 var(--mono); letter-spacing: .04em; color: #5d6268;
}

/* ---------- mobile: board fills the width, page scrolls ---------- */
@media (max-width: 699px) {
  .win { max-height: 70svh; }
  .win__bar { height: 56px; gap: 9px; padding: 0 12px; }
  .win__title { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .win, .win.is-closing { animation-duration: .01s; }
  .hint, .hint::after { animation: none; }
}
