/* VibeBuddy — clean shell, pixel soul. Dark by default. */
:root {
  --bg: #141416;
  --surface: #1d1d21;
  --surface-2: #26262b;
  --border: #333338;
  --text: #ececef;
  --text-dim: #9b9ba3;
  --text-faint: #6b6b73;
  /* macaron ramps (light stop / deep stop) */
  --coral: #f5c4b3; --coral-d: #d85a30;
  --lav: #cecbf6;   --lav-d: #7f77dd;
  --mint: #9fe1cb;  --mint-d: #1d9e75;
  --pink: #f4c0d1;  --pink-d: #d4537e;
  --butter: #fac775;--butter-d: #ba7517;
  --sky: #b5d4f4;   --sky-d: #378add;
  --ok: #34c98e;
  --radius: 10px;
}
:root[data-theme='light'] {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --border: #dddbd4;
  --text: #1c1c1e;
  --text-dim: #5f5f66;
  --text-faint: #97979e;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
/* desktop floating panel: frosted translucency (opt-in via ?translucent=1) */
html[data-translucent], html[data-translucent] body { background: transparent; }
html[data-translucent] .column { background: color-mix(in srgb, var(--bg) 86%, transparent); }
html[data-translucent] .statusbar, html[data-translucent] .tabs { backdrop-filter: blur(6px); }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
  overscroll-behavior: none;
}
#app { height: 100%; display: flex; justify-content: center; }
.column {
  width: 100%;
  max-width: 420px;
  min-width: 320px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
button {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
}
button:hover { border-color: var(--text-faint); }
button.primary { background: var(--mint); color: #04342c; border: none; font-weight: 600; }
input[type='text'] {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  outline: none;
  width: 100%;
}
input[type='text']:focus { border-color: var(--lav-d); }
.pixel { image-rendering: pixelated; }

/* status header */
.statusbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.statusbar .txt { flex: 1; min-width: 0; }
.statusbar .line1 { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.statusbar .line1 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.statusbar .line1 .dot.working { background: var(--ok); }
.statusbar .line1 .dot.waiting_input { background: var(--butter-d); }
.statusbar .bar { height: 4px; background: var(--surface-2); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.statusbar .bar > div { height: 100%; background: var(--ok); border-radius: 999px; transition: width 1s linear; }
.statusbar .eta { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }

/* main area */
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.feed { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; font-size: 14px; }
.msg .who { font-weight: 600; flex-shrink: 0; }
.msg .body { color: var(--text-dim); overflow-wrap: anywhere; }
.roomhead { padding: 8px 14px; font-size: 12px; color: var(--text-faint); border-bottom: 1px solid var(--border); }
.composer { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }

/* tab bar */
.tabs {
  display: flex; border-top: 1px solid var(--border); flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; border: none; background: none; border-radius: 0;
  padding: 10px 0 12px; color: var(--text-faint); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tabs button.active { color: var(--text); }
.tabs .glyph { font-size: 17px; line-height: 1; }

/* landing */
.landing {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center;
}
.landing h1 { font-size: 22px; }
.landing p { color: var(--text-dim); font-size: 14px; max-width: 260px; }
.landing .egg { margin-bottom: 6px; }

.empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-dim); font-size: 14px; text-align: center; padding: 24px;
}

/* done banner — celebration, not interruption */
.donebanner {
  position: relative;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--mint) 12%, var(--surface));
  text-align: center;
  flex-shrink: 0;
  overflow: hidden;
}
.donetitle { font-size: 16px; font-weight: 700; }
.donesub { font-size: 12px; color: var(--text-dim); margin: 4px 0 12px; }
.staylink { font-size: 11px; color: var(--text-faint); margin-top: 8px; cursor: pointer; }
.confetti { position: absolute; width: 5px; height: 5px; animation: drop 1.6s ease-in infinite; }
.confetti.c1 { left: 12%; top: -6px; background: var(--coral-d); animation-delay: 0s; }
.confetti.c2 { left: 34%; top: -6px; background: var(--lav-d); animation-delay: .3s; }
.confetti.c3 { left: 64%; top: -6px; background: var(--mint-d); animation-delay: .15s; }
.confetti.c4 { left: 86%; top: -6px; background: var(--butter-d); animation-delay: .45s; }
@keyframes drop { to { transform: translateY(110px) rotate(180deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { animation: none; display: none; } }

/* ship ticker */
.shipticker {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.adds { color: var(--mint-d); margin-left: 6px; }
.dels { color: var(--coral-d); margin-left: 4px; }

/* me tab — the desk */
.metab { flex: 1; overflow-y: auto; padding: 18px 16px; }
.deskrow { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.deskname { font-size: 18px; font-weight: 700; }
.desksub { font-size: 13px; color: var(--text-dim); }
.section { margin-bottom: 20px; }
.sectionhead { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.dim { color: var(--text-faint); font-size: 12px; }
.gardengrid { display: flex; flex-wrap: wrap; gap: 8px; }
.shiprow { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.shiptitle { color: var(--text-dim); }
.cmd {
  display: inline-block; margin-top: 6px;
  font: 13px/1.6 ui-monospace, 'Cascadia Mono', Consolas, monospace;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; user-select: all;
}

/* chats */
.chats { flex: 1; overflow-y: auto; padding: 14px 16px; }
.friendrow, .convrow { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.fname { font-weight: 600; }
.fstatus { color: var(--text-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convtxt { min-width: 0; flex: 1; }
.convname { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.convlast { color: var(--text-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.groupglyph { width: 24px; text-align: center; color: var(--text-dim); }
.unreaddot { width: 7px; height: 7px; border-radius: 50%; background: var(--sky-d); display: inline-block; }
.tabdot { position: relative; top: -8px; left: -2px; }
.clickable { cursor: pointer; }
.mini { padding: 4px 12px; font-size: 12px; }
.mini.danger { color: var(--coral-d); }
.mini-link { float: right; font-size: 12px; color: var(--text-faint); cursor: pointer; }
.groupform { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pickrow { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { font-size: 13px; color: var(--text-dim); display: flex; gap: 6px; align-items: center; }
.threadhead { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.agentbadge {
  font-size: 10px; background: var(--lav); color: #26215c;
  padding: 1px 7px; border-radius: 999px; flex-shrink: 0; align-self: center;
}
.chatimg { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; margin-top: 4px; }
.filelink { color: var(--sky-d); display: block; margin-top: 2px; }
.iconbtn { padding: 7px 10px; }
.formerr { padding: 4px 14px; color: var(--coral-d); font-size: 12px; }

/* profile overlay */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
.profilecard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  width: min(92vw, 360px); max-height: 80vh; overflow-y: auto; padding: 18px;
}
.profiletop { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.closex { margin-left: auto; color: var(--text-faint); align-self: flex-start; }
.profileactions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* table for three */
.tablebar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.sizes { display: flex; gap: 4px; }
.sizeopt {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-faint); cursor: pointer;
}
.sizeopt.on { border-color: var(--mint-d); color: var(--text); }
.tablehead { display: flex; align-items: center; gap: 10px; }
.tablehead .members { display: flex; gap: 4px; flex: 1; }
.candle { height: 4px; background: var(--surface-2); }
.candle > div { height: 100%; background: linear-gradient(90deg, var(--butter-d), var(--butter)); transition: width 3s linear; }
.icebreaker {
  margin: 10px 14px 0; padding: 8px 12px; font-size: 12px; color: var(--text-dim);
  background: var(--surface); border: 1px dashed var(--border); border-radius: 10px;
}
.tableactions { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 14px; }
.candlewrap { font-size: 28px; }
.candleflame { animation: flicker 1.2s steps(2) infinite; }
@keyframes flicker { 50% { transform: translateY(-2px); } }

/* toast */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 70px; z-index: 30;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 999px; font-size: 13px;
  max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.column { position: relative; }

/* play tab */
.newgame { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.newgame select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px;
}
.pillrow { display: flex; gap: 6px; flex-wrap: wrap; }
.sizeopt.wide { width: auto; padding: 0 12px; border-radius: 999px; height: 26px; }
.gameglyph { width: 24px; text-align: center; color: var(--text-dim); font-size: 16px; }
.ladderrow { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.ladderrow .rank { width: 30px; color: var(--text-faint); }
.ladderrow .rating { margin-left: auto; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.turnline { padding: 8px 14px; font-size: 12px; color: var(--text-dim); }
.gameover { padding: 10px 14px; font-size: 14px; font-weight: 700; color: var(--mint-d); }
.players { display: flex; align-items: center; gap: 6px; font-size: 12px; flex: 1; justify-content: flex-end; }
.turnname { font-weight: 700; }
.boardwrap { padding: 10px 14px; overflow-x: auto; }
.gomoku {
  display: grid; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  max-width: 390px; aspect-ratio: 1;
}
.gcell { background: var(--surface); position: relative; cursor: pointer; min-height: 0; }
.gcell.a::after, .gcell.b::after {
  content: ''; position: absolute; inset: 12%; border-radius: 50%;
}
.gcell.a::after { background: var(--mint); }
.gcell.b::after { background: var(--pink); }
.c4 {
  display: grid; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px; max-width: 340px;
}
.c4cell { aspect-ratio: 1; cursor: pointer; }
.c4cell .disc { width: 100%; height: 100%; border-radius: 50%; background: var(--bg); }
.c4cell.a .disc { background: var(--butter); }
.c4cell.b .disc { background: var(--sky-d); }

/* pet battles */
.battlecard { text-align: center; }
.battlehead { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.fighter { display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .3s steps(2); }
.fighter.attacking { transform: translateY(-4px); }
.vs { font-size: 20px; }
.hpbar { width: 90px; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hpbar > div { height: 100%; background: var(--mint-d); transition: width .6s steps(4); }
.battlelog { min-height: 44px; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }
.battlewin { color: var(--butter-d); font-weight: 700; }

/* tickets */
.statuschip { font-size: 10px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-dim); }
.statuschip.s-sent { background: var(--butter); color: #412402; }
.statuschip.s-accepted { background: var(--sky); color: #042c53; }
.statuschip.s-returned { background: var(--mint); color: #04342c; }
.statuschip.s-declined { background: var(--surface-2); color: var(--text-faint); }
.ticketcard { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-top: 8px; font-size: 13px; }
.riskbox {
  border: 1px solid var(--coral-d); background: color-mix(in srgb, var(--coral-d) 12%, var(--surface));
  color: var(--coral-d); border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-top: 8px;
}
.ziplist { margin-top: 8px; font-size: 12px; }
.zipentry { display: flex; justify-content: space-between; color: var(--text-dim); font-family: ui-monospace, Consolas, monospace; padding: 1px 0; }
.zipentry span { color: var(--text-faint); }
.ticketform { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 12px; }

/* link approve */
.linkcode {
  font: 700 26px/1 ui-monospace, Consolas, monospace;
  letter-spacing: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 18px;
}
