/* =========================================================
   OSCASULLOS OS — vintage Mac desk, 90s pastel
   ========================================================= */
:root {
  --ink: #1b1b1b;
  --paper: #fff6dc;      /* window body */
  --cream: #fbefc9;      /* desktop */
  --pink: #f7a8c8;
  --lilac: #c9b6f0;
  --green: #b8e07a;
  --yellow: #ffe58a;
  --orange: #f2a06b;
  --teal: #9fe0d8;
  --shadow: 4px 4px 0 var(--ink);
  --menubar: 32px;
  --tray: 64px;
  --ui: "Pixelify Sans", "Chicago", "Geneva", system-ui, sans-serif;
  --text: "Comic Neue", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;   /* readable, still bootleg */
  /* spacing scale (4pt) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --mono: "IBM Plex Mono", "Monaco", "Courier New", monospace;
}
* { box-sizing: border-box; font-variant-ligatures: none !important; font-feature-settings: "calt" 0, "liga" 0, "clig" 0, "rlig" 0 !important; } /* Pixelify's contextual alternates turn "fi" into an "A" */
html, body { margin: 0; height: 100%; background: var(--cream); }
body { font-family: var(--text); font-size: 17px; line-height: 1.55; color: var(--ink); overflow: hidden; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }

#screen {
  position: fixed; inset: 0; overflow: hidden;
  display: grid; grid-template-rows: var(--menubar) 1fr var(--tray);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: radial-gradient(circle, rgba(27,27,27,.10) 1px, transparent 1.4px) 0 0 / 12px 12px, var(--cream);
}

/* ---------- svg drawing style (flat pastel, black outline) ---------- */
svg { overflow: visible; }
.obj svg, .tray-btn svg, .mb-logo svg { fill: none; stroke: var(--ink); stroke-linejoin: round; stroke-linecap: round; }
.fillbg { fill: var(--paper); }
.fillfg { fill: var(--ink); }
.strokebg { stroke: var(--paper); }
.c-pink { fill: var(--pink); } .c-lilac { fill: var(--lilac); } .c-green { fill: var(--green); }
.c-yellow { fill: var(--yellow); } .c-orange { fill: var(--orange); } .c-teal { fill: var(--teal); }
.svgtxt { font-family: var(--ui); font-weight: 700; font-size: 10px; fill: var(--ink); stroke: none; letter-spacing: .5px; }
.svgtxt.sm { font-size: 9px; } .svgtxt.xs { font-size: 7.5px; }

/* ---------- startup (happy-Mac style) ---------- */
#boot { position: absolute; inset: 0; z-index: 800; display: grid; place-items: center; background: var(--cream); cursor: pointer; }
#boot.gone { animation: bootOff .35s steps(4) forwards; }
@keyframes bootOff { to { opacity: 0; visibility: hidden; } }
.boot-win { width: min(380px, 88vw); background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow); text-align: center; padding: 22px 22px 18px; }
.boot-fish { margin: 0 0 10px; font: 700 15px/1.1 var(--mono); white-space: pre; }
.boot-title { font: 700 20px var(--ui); margin: 0 0 14px; }
.boot-bar { height: 16px; border: 2px solid var(--ink); background: var(--paper); padding: 2px; }
.boot-bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 8px); transition: width .12s steps(2); }
#bootText { margin: 10px 0 0; min-height: 1.3em; font-size: 13px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.boot-skip { margin-top: 10px; font-size: 12px; opacity: .6; }

/* ---------- menu bar ---------- */
#menubar {
  display: flex; align-items: center; gap: 2px; padding: 0 8px; z-index: 50; white-space: nowrap;
  background: var(--paper); border-bottom: 2px solid var(--ink); font: 700 16px var(--ui);
}
.mb-item { padding: 0 9px; height: 28px; line-height: 28px; }
button.mb-item:hover, button.mb-item:active { background: var(--ink); color: var(--paper); }
.mb-logo { display: grid; place-items: center; }
.mb-logo svg { width: 26px; stroke-width: 1.8; }
button.mb-logo:hover svg, button.mb-logo:active svg { stroke: var(--paper); }
.mb-spacer { flex: 1; }
.mb-date, .mb-time { font-weight: 500; }
.mb-time { border-left: 2px solid var(--ink); }
.mb-lang { margin-left: 6px; height: 24px; line-height: 20px; min-width: 38px; border: 2px solid var(--ink); background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); font-size: 13px; position: relative; }
.mb-lang::before { content: ""; position: absolute; inset: -10px -4px; }

/* ---------- room ---------- */
#room { position: relative; display: grid; grid-template-rows: 54% 46%; min-height: 0; }
.wall { position: relative; display: grid; grid-template-columns: 1fr 3.6fr 1fr; align-items: center; justify-items: center; padding: 2% 3% 0; }
.obj { display: block; transition: transform .15s; }
.obj:hover { transform: translateY(-3px); }
.obj:active { transform: translateY(1px); }
.clock svg { width: clamp(64px, 10vw, 112px); stroke-width: 2.5; }
.frame { transform: rotate(2deg); } .frame:hover { transform: rotate(-1deg) translateY(-3px); }
.frame svg { width: clamp(64px, 9vw, 104px); }

/* the welcome window with the ASCII fish */
.plaque { width: min(100%, 760px); text-align: left; background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow); }
.plaque:hover { transform: translateY(-3px); }
.plaque .titlebar { background-color: var(--pink); justify-content: flex-start; padding-right: var(--s4); }
.billy-stage { position: relative; display: block; }
#asciiFish { display: block; margin: 0; padding: 8px 6px 4px; text-align: center; white-space: pre; overflow: hidden; font: 700 4px/1.05 var(--mono); letter-spacing: 0; }
.billy-bubble {
  position: absolute; left: 4%; top: 2px; max-width: 62%; padding: 4px 10px; z-index: 2;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink);
  font: 700 clamp(11px, 1.3vw, 15px)/1.2 var(--ui); opacity: 0; transform: translateY(4px) scale(.96); transition: opacity .15s, transform .15s;
}
.billy-bubble::after { content: ""; position: absolute; left: 22px; bottom: -9px; width: 12px; height: 12px; background: var(--paper); border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); }
.billy-bubble.show { opacity: 1; transform: none; }
.billy-bubble span { opacity: .28; }
.billy-bubble span.sung { opacity: 1; }
.brass { margin: 0 12px 10px; border: 2px solid var(--ink); background: var(--yellow); text-align: center; font: 700 clamp(11px, 1.3vw, 15px) var(--ui); letter-spacing: 1.5px; padding: 3px 4px; }

/* the desk */
.desk { position: relative; display: grid; grid-template-rows: 1fr auto; padding: 0 3%; }
.desk-top { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; justify-items: center; padding: 3% 6% 2%; }
.desk-top::before {
  content: ""; position: absolute; inset: 0; z-index: 0; background: var(--ink);
  clip-path: polygon(7% 0, 93% 0, 100% 100%, 0 100%);
}
.desk-top::after {
  content: ""; position: absolute; inset: 3px 3px 0; z-index: 0;
  clip-path: polygon(calc(7% + 1px) 0, calc(93% - 1px) 0, 100% 100%, 0 100%);
  background: repeating-linear-gradient(176deg, transparent 0 22px, rgba(27,27,27,.08) 22px 24px), #ffe9a8;
}
/* desk objects: one hand-made family. Same frontal view, same box, same stroke,
   same hard ink shadow as the windows, labels on one baseline. Slight wonky tilts on purpose. */
.desk-top { align-items: end; }
.item { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: var(--s3); min-width: 44px; min-height: 44px; padding-bottom: var(--s2); }
.item svg { width: clamp(110px, 16vw, 190px); aspect-ratio: 120 / 96; stroke-width: 2.6; transition: transform .18s cubic-bezier(.2,.9,.3,1); }
.item svg .shadow * { fill: var(--ink); stroke: var(--ink); }
.item:nth-child(1) svg { rotate: -3deg; } .item:nth-child(2) svg { rotate: 2deg; }
.item:nth-child(3) svg { rotate: -1.5deg; } .item:nth-child(4) svg { rotate: 3deg; }
.item:hover svg, .item:focus-visible svg { transform: translateY(-5px) rotate(-2deg); }
.item .label { font: 700 14px var(--ui); letter-spacing: 1px; padding: var(--s1) var(--s3); background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.item:hover .label, .item:focus-visible .label { background: var(--ink); color: var(--paper); }
.drawers { display: grid; grid-template-columns: 1fr 1fr; gap: 5%; padding: 0 1% 10px; }
.drawer { height: clamp(26px, 5vh, 44px); border: 2px solid var(--ink); border-top: 0; background: #f6dc8e; display: grid; place-items: center; }
.handle { width: 30%; height: 8px; border: 2px solid var(--ink); background: var(--paper); border-radius: 4px; }

/* ---------- tray ---------- */
#tray { position: relative; z-index: 50; display: grid; grid-template-columns: repeat(7, 1fr); background: var(--paper); border-top: 2px solid var(--ink); }
.tray-btn { display: grid; place-items: center; border-right: 2px solid var(--ink); min-height: 44px; }
.tray-btn:last-of-type { border-right: 0; }
.tray-btn svg { width: clamp(30px, 6vw, 40px); stroke-width: 2; }
@media (hover: hover) { .tray-btn:hover { background: var(--yellow); } }
.tray-btn[aria-pressed="true"] { background: var(--pink); }
.tray-btn[aria-pressed="true"] svg { animation: wiggle .5s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
#traySay {
  position: absolute; left: 50%; bottom: calc(100% + 10px); translate: -50% 0; white-space: nowrap;
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); padding: 3px 12px; font: 700 15px var(--ui);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
#traySay.show { opacity: 1; }

/* ---------- windows ---------- */
#windows { position: absolute; inset: 0; pointer-events: none; z-index: 100; }
.win {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column;
  left: 50%; top: calc(var(--menubar) + 24px); translate: -50% 0;
  width: min(560px, 94vw); max-height: calc(100% - var(--menubar) - var(--tray) - 40px);
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  animation: winOpen .16s steps(3);
}
.win.wide { width: min(800px, 94vw); }
.win.xwide { width: min(1040px, 96vw); }
@keyframes winOpen { from { transform: scale(.94) rotate(-.6deg); } to { transform: none; } }  /* transform only: never leaves a window see-through */
.titlebar {
  position: relative; flex: none; min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s1) var(--s1) var(--s1) var(--s4);
  border-bottom: 2px solid var(--ink); background: var(--lilac); touch-action: none; user-select: none;
  /* classic Mac stripes, a little wonky on purpose */
  background-image: repeating-linear-gradient(to bottom, transparent 0 5px, rgba(27,27,27,.18) 5px 6px);
  background-size: 100% 24px; background-position: 0 50%; background-repeat: no-repeat;
}
.win[data-color="pink"] .titlebar { background-color: var(--pink); }
.win[data-color="green"] .titlebar { background-color: var(--green); }
.win[data-color="yellow"] .titlebar { background-color: var(--yellow); }
.win[data-color="orange"] .titlebar { background-color: var(--orange); }
.title { font: 700 17px var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: inherit; padding: 0 var(--s2); }
/* close: always visible, says what it does, big enough to hit with a thumb */
.close {
  flex: none; display: inline-flex; align-items: center; gap: var(--s2); position: relative;
  height: 32px; padding: 0 var(--s3) 0 var(--s2); border: 2px solid var(--ink); border-radius: 6px;
  background: var(--paper); box-shadow: 2px 2px 0 var(--ink); font: 700 15px var(--ui); color: var(--ink);
}
.close .x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--paper); font: 700 15px/1 var(--ui); }
.close:hover, .close:focus-visible { background: var(--orange); }
.close:active { translate: 2px 2px; box-shadow: none; }
.close::before { content: ""; position: absolute; inset: -6px -4px; } /* >=44px tap target */
.body { overflow: auto; padding: var(--s5) var(--s5) var(--s6); overscroll-behavior: contain; }
.body h2 { font: 700 24px/1.15 var(--ui); margin: 0 0 var(--s3); }
.body h3 { font: 700 18px var(--ui); margin: 0 0 var(--s2); }
.body p { margin: 0 0 var(--s4); line-height: 1.6; max-width: 62ch; }
.dim { opacity: .65; }
.ascii { margin: 0 0 var(--s4); font: 700 16px var(--mono); }
@media (min-width: 760px) and (hover: hover) { .titlebar { cursor: grab; } }

.btn {
  border: 2px solid var(--ink); border-radius: 6px; padding: 4px 14px; font: 700 15px var(--ui);
  background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); min-height: 34px;
}
.btn:hover { background: var(--pink); }
.btn:active { translate: 2px 2px; box-shadow: none; }
.btn:disabled { opacity: .6; }
input, textarea { font: 400 17px var(--text); color: var(--ink); background: #fffdf4; border: 2px solid var(--ink); padding: var(--s2) var(--s3); width: 100%; border-radius: 0; box-shadow: inset 2px 2px 0 rgba(27,27,27,.12); }
input::placeholder, textarea::placeholder { color: rgba(27,27,27,.45); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--ink); flex: none; box-shadow: none; }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.switch { display: inline-flex; align-items: center; gap: var(--s2); line-height: 1; min-height: 44px; cursor: pointer; font: 700 14px var(--ui); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .sw { flex: none; width: 46px; height: 26px; border: 2px solid var(--ink); border-radius: 13px; background: var(--paper); position: relative; box-shadow: 2px 2px 0 var(--ink); }
.switch .sw::after { content: ""; position: absolute; top: 50%; translate: 0 -50%; left: 2px; width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); transition: left .12s; }
.switch input:checked + .sw { background: var(--green); }
.switch input:checked + .sw::after { left: 22px; }
.switch input:focus-visible + .sw { outline: 2px dashed var(--ink); outline-offset: 3px; }

/* statutes */
.statutes ol { list-style: none; padding: 0; margin: var(--s5) 0; display: grid; gap: var(--s5); }
.statutes li { border: 2px solid var(--ink); background: #fffdf4; box-shadow: 3px 3px 0 var(--ink); padding: var(--s4) var(--s5); line-height: 1.55; font-size: 18px; }
.statutes li:nth-child(1) { background: #fde3ee; } .statutes li:nth-child(2) { background: #ece5fb; } .statutes li:nth-child(3) { background: #e9f6d6; }
.statutes li::before { content: attr(data-art); display: block; font: 700 15px var(--ui); margin-bottom: var(--s2); }

/* game */
.hud { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); font: 700 15px var(--ui); }
.hud b { font-size: 22px; }
#gameCanvas { display: block; width: 100%; aspect-ratio: 320 / 220; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); image-rendering: pixelated; touch-action: none; cursor: crosshair; background: var(--teal); }
.ticker { min-height: 1.6em; margin: var(--s4) 0 var(--s5); }
.ticker.bad { background: var(--pink); border: 2px solid var(--ink); padding: 2px 8px; font-weight: 700; animation: blink .3s steps(1) 4; }
@keyframes blink { 50% { opacity: 0; } }
.record { border: 2px dashed var(--ink); background: #fffdf4; padding: var(--s4) var(--s5); margin: 0 0 var(--s5); display: grid; gap: var(--s3); }
.check { display: flex; gap: var(--s3); align-items: flex-start; line-height: 1.45; }
.board { border-top: 2px solid var(--ink); padding-top: var(--s5); }
.board ol { list-style: none; margin: var(--s3) 0; padding: 0; border: 2px solid var(--ink); background: #fffdf4; }
.board li { display: flex; gap: var(--s3); padding: var(--s2) var(--s3); border-bottom: 1px solid rgba(27,27,27,.2); }
.board li:last-child { border-bottom: 0; }
.board li .rk { width: 2.6em; font-family: var(--ui); font-weight: 700; }
.board li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li .sc { font-weight: 700; }
.board li.first { background: var(--yellow); font-weight: 700; }
.board li.empty { opacity: .4; justify-content: center; }

/* members: big cards that put the photos first */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s6) var(--s5); }
.mcard { position: relative; background: var(--paper); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); display: flex; flex-direction: column; }
.mcard .mbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 10px; border-bottom: 2px solid var(--ink); font: 700 17px var(--ui); background: var(--lilac); }
.mcard:nth-child(4n+1) .mbar { background: var(--pink); } .mcard:nth-child(4n+2) .mbar { background: var(--green); }
.mcard:nth-child(4n+3) .mbar { background: var(--yellow); } .mcard:nth-child(4n+4) .mbar { background: var(--lilac); }
.mcard .no { font-size: 12px; font-weight: 500; }
.mcard .ph { aspect-ratio: 4 / 5; border-bottom: 2px solid var(--ink); overflow: hidden; background: #eadfbd; }
.mcard .ph img, .mcard .ph canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.mcard .ph canvas { image-rendering: pixelated; }
.mcard dl { margin: 0; padding: var(--s4) var(--s4) var(--s5); display: grid; grid-template-columns: auto 1fr; gap: var(--s3) var(--s3); line-height: 1.4; }
.mcard dt { font: 700 12px var(--ui); letter-spacing: .5px; padding-top: 2px; }
.mcard dd { margin: 0; }
.mcard .fishcount { font: 700 20px var(--ui); }
.mcard .newtag { position: absolute; top: 40px; right: -10px; z-index: 2; background: var(--orange); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font: 700 13px var(--ui); padding: 2px 8px; rotate: 8deg; }

/* message */
.message form { display: grid; gap: var(--s5); margin-bottom: var(--s5); }
.message label { display: grid; gap: var(--s2); font: 700 15px var(--ui); }
.message textarea { resize: vertical; }
.message .btn { justify-self: start; }
#bottles { list-style: none; padding: 0; margin: var(--s5) 0 0; display: grid; gap: var(--s4); }
#bottles li { border: 2px solid var(--ink); background: #fffdf4; box-shadow: 3px 3px 0 var(--ink); padding: var(--s3) var(--s4); line-height: 1.55; word-wrap: break-word; }
#bottles .from { display: block; margin-bottom: var(--s2); font: 700 14px var(--ui); }

/* album */
.page { margin: 0; border: 2px solid var(--ink); background: #fffdf4; padding: 10px; box-shadow: 3px 3px 0 var(--ink); }
.pic { display: grid; place-items: center; height: min(52vh, 480px); background: #eadfbd; border: 2px solid var(--ink); overflow: hidden; }
.pic img, .pic canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.pic canvas { image-rendering: pixelated; }
.page figcaption { margin-top: var(--s3); text-align: center; min-height: 1.3em; font-weight: 700; }
.pager { display: flex; justify-content: center; align-items: center; gap: var(--s5); margin-top: var(--s5); font: 700 15px var(--ui); }

/* ---------- phones (portrait) ---------- */
@media (max-width: 700px) {
  :root { --tray: 58px; }
  .hide-sm, .mb-item[data-i18n="mb.file"] { display: none; }
  .mb-item { padding: 0 6px; }
  #menubar { font-size: 15px; }
  #room { grid-template-rows: auto minmax(0, 1fr); }
  .wall { grid-template-columns: 1fr 1fr; }
  .wall { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; padding: 3% 4% 2%; row-gap: 8px; }
  .plaque { grid-column: 1 / -1; grid-row: 1; width: 100%; }
  .clock { grid-row: 2; } .frame { grid-row: 2; }
  .clock svg { width: 48px; } .frame svg { width: 44px; }
  .desk { padding: 0 2%; }
  .desk-top { grid-template-columns: 1fr 1fr; padding: 4% 9% 2%; row-gap: 6px; }
  /* size the objects by the space the desk really has (Safari's toolbars eat height):
     each of the 2 rows gets half the desk height, minus the label (~58px). */
  .desk-top { container-type: size; padding-top: 3%; padding-bottom: 1%; row-gap: 0; }
  .item { gap: var(--s2); padding-bottom: 0; }
  .item svg { width: min(34vw, 150px, calc((50cqh - 58px) * 1.25)); }
  .item .label { font-size: 13px; }
  .drawer { height: 22px; }
  .body { padding: var(--s5) var(--s4) var(--s6); }
  .close .close-txt { display: none; }
  .close { padding: 0 var(--s2); }
  .win, .win.wide, .win.xwide { width: calc(100% - 16px); top: calc(var(--menubar) + 8px); max-height: calc(100% - var(--menubar) - var(--tray) - 16px); }
  .cards { grid-template-columns: 1fr; }
  .pic { height: 44vh; }
  #traySay { font-size: 14px; }
}
/* short phone screens (Safari with its toolbars): the desk is wide and short, so one row of four */
@media (max-width: 700px) and (max-height: 760px) {
  .desk-top { grid-template-columns: repeat(4, 1fr); padding: 3% 5% 2%; column-gap: var(--s1); align-items: center; }
  .item svg { width: min(21vw, 100px, calc((100cqh - 52px) * 1.25)); }
  .item .label { font-size: 11.5px; padding: 2px 6px; letter-spacing: .5px; }
}
@media (max-height: 560px) and (min-width: 701px) { .item svg { width: clamp(80px, 11vw, 140px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
