:root {
  --bg: #232830;
  --bg-2: #2e3440;
  --ink: #3b2830;
  --ink-soft: #6c5660;
  --paper: #fff6e8;
  --paper-2: #f6e8d2;
  --paper-3: #ead7ba;
  --peach: #f4a883;
  --peach-2: #e98f7a;
  --rose: #f07f95;
  --sage: #a2c291;
  --sky: #90b6de;
  --gold: #f3cf7a;
  --line: 2px solid var(--ink);
  --shadow: 0 3px 0 rgba(20, 12, 18, 0.55);
  --radius: 6px;
  --font: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Quicksand', 'Varela Round', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 28%, #3a4150 0%, var(--bg) 62%);
  color: var(--paper);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.px-icon { display: block; width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s, background 0.15s;
  text-decoration: none;
}
.btn:hover { background: #fffaf2; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(20, 12, 18, 0.55); }
.btn.primary { background: var(--peach); }
.btn.primary:hover { background: #f7b793; }
.btn.ghost { background: transparent; color: var(--paper); border-color: rgba(255, 246, 232, 0.5); box-shadow: none; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 15px; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn .px-icon { width: 16px; height: 16px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(20, 12, 18, 0.55); }
.icon-btn.on { background: var(--gold); }
.icon-btn .label { display: none; }
@media (min-width: 1100px) { .icon-btn .label { display: inline; } }

/* ------------------------------------------------------------ layout */

.app {
  display: grid;
  height: 100dvh;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas: "hud" "stage" "side";
  padding-top: var(--safe-t);
}
.hud { grid-area: hud; }
.stage { grid-area: stage; }
.side { grid-area: side; }

@media (min-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "hud side" "stage side";
  }
}

.hud { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 4px; }
.hud-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.office-name { margin: 0; font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12em; flex: none; }
.rooms { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.rooms::-webkit-scrollbar { display: none; }
.room-tab {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  height: 38px; padding: 0 12px; border: var(--line); border-radius: 999px;
  background: var(--bg-2); color: var(--paper); font-weight: 800; font-size: 14px; cursor: pointer;
}
.room-tab.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.room-tab .room-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--sage); color: var(--ink); font-size: 12px; line-height: 18px; text-align: center; }
.room-tab .px-icon { width: 13px; height: 13px; opacity: 0.85; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #e0525e; box-shadow: 0 0 0 2px rgba(224, 82, 94, 0.3); animation: rec 1.4s infinite; flex: none; }
.hud-buttons { display: flex; gap: 6px; flex: none; }
.hud-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.hud-tools .icon-btn { height: 38px; min-width: 40px; }
.icon-btn.warn { background: #f7c1c3; }
@media (max-width: 640px) {
  .office-name { display: none; }
  .hud-tools .icon-btn { flex: 1; }
  .room-tab { height: 34px; padding: 0 7px; font-size: 12.5px; gap: 3px; }
  .rooms { gap: 3px; }
  .hud-buttons .icon-btn { min-width: 38px; height: 38px; padding: 0 8px; }
}

.side { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 0 8px calc(8px + var(--safe-b)); }
@media (min-width: 900px) { .side { padding: 10px 12px 12px 0; } }
.people { display: flex; gap: 6px; min-width: 0; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; flex: none; }
@media (min-width: 900px) {
  .people { flex-direction: column; overflow-x: hidden; overflow-y: auto; max-height: 38vh; }
  .people .person { border-radius: 12px; width: 100%; }
  .people .person .name, .people .person .status { max-width: none; }
}
.pic { position: relative; flex: none; line-height: 0; }
.pic .dot { position: absolute; right: -1px; bottom: -1px; }

.person {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 3px 12px 3px 4px;
  border: var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  flex-shrink: 0;
  text-align: left;
}
.person canvas { image-rendering: pixelated; border-radius: 50%; background: var(--paper-2); flex: none; }
.person .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.person .name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11em; display: flex; align-items: center; gap: 4px; }
.person .name .px-icon { width: 13px; height: 13px; color: #c89a2a; }
.person .status { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16em; display: block; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #9a8f95; border: 1.5px solid var(--ink); flex: none; }
.dot.here { background: #7fcf7a; }
.dot.idle { background: var(--gold); }
.dot.away { background: #c7b3bd; }
.person.invite { background: var(--gold); border-style: dashed; padding: 6px 14px; font-weight: 800; white-space: nowrap; flex-shrink: 0; }

.invite-card {
  margin: 4px 0 8px;
  padding: 12px 14px;
  border: 2px dashed var(--peach-2);
  border-radius: 12px;
  background: #fff1e6;
}
.invite-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 16px; }
.invite-card h3 .px-icon { color: var(--peach-2); }
.invite-card p { margin: 4px 0 8px; font-size: 14px; }
.invite-card .fine { margin: 8px 0 0; }

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px 8px;
  min-height: 0;
}
.room-wrap { position: relative; line-height: 0; touch-action: manipulation; }
#room {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 4px;
  cursor: pointer;
  touch-action: none;
}
.overlay { position: absolute; inset: 0; pointer-events: none; line-height: 1.3; }

.banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border: var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 5;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: calc(100% - 24px);
}

/* ------------------------------------------------------------ overlay: names & bubbles */

.tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(42, 32, 41, 0.72);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tag.away { background: rgba(42, 32, 41, 0.6); color: #d8cbd2; }

.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: min(240px, 60vw);
  width: max-content;
  padding: 6px 10px;
  background: #fffdf8;
  color: var(--ink);
  border: var(--line);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  box-shadow: 0 2px 0 rgba(20, 12, 18, 0.35);
  overflow-wrap: anywhere;
  animation: pop-in 0.18s ease-out;
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: #fffdf8;
  border-right: var(--line);
  border-bottom: var(--line);
  transform: rotate(45deg) scaleX(0.8);
}
.bubble.typing { padding: 4px 10px; font-size: 18px; letter-spacing: 2px; }
.bubble.fading { opacity: 0; transition: opacity 0.5s; }
@keyframes pop-in { from { transform: translate(-50%, -90%) scale(0.85); opacity: 0; } to { transform: translate(-50%, -100%) scale(1); opacity: 1; } }

/* ------------------------------------------------------------ context menu */

.menu {
  position: fixed;
  z-index: 40;
  min-width: 210px;
  max-width: min(300px, calc(100vw - 16px));
  padding: 6px;
  border: var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(20, 12, 18, 0.5), 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: menu-in 0.12s ease-out;
}
@keyframes menu-in { from { transform: translateY(4px); opacity: 0; } }
.menu h3 { margin: 4px 8px 2px; font-size: 15px; }
.menu .sub { margin: 0 8px 6px; font-size: 13px; color: var(--ink-soft); }
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: var(--paper-2); }
.menu button:disabled { color: var(--ink-soft); cursor: default; background: transparent; font-weight: 600; }
.menu .px-icon { color: var(--peach-2); }

/* ------------------------------------------------------------ chat */

.chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 220px;
  border: var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 14px 4px;
  border-bottom: 2px solid var(--paper-3);
}
.chat-tabs { display: flex; gap: 4px; padding: 6px 8px 2px; overflow-x: auto; scrollbar-width: none; flex: none; }
.chat-tab { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px 0 6px; border: 2px solid transparent; border-radius: 999px; background: var(--paper-2); color: var(--ink); font-weight: 800; font-size: 13px; cursor: pointer; flex: none; }
.chat-tab.on { border-color: var(--ink); background: #fff; }
.chat-tab canvas { image-rendering: pixelated; border-radius: 50%; }
.chat-tab .px-icon { width: 14px; height: 14px; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--rose); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.chat-head h2 { margin: 0; font-size: 16px; }
.chat-sub { font-size: 13px; color: var(--ink-soft); }
.chat-log {
  flex: 1;
  min-height: 60px;
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overscroll-behavior: contain;
}
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .text {
  padding: 6px 11px;
  border-radius: 12px 12px 12px 4px;
  background: var(--paper-2);
  border: 2px solid var(--paper-3);
  overflow-wrap: anywhere;
  font-size: 15px;
}
.msg.mine .text { background: #ffe1cf; border-color: #f5c7ad; border-radius: 12px 12px 4px 12px; }
.msg .meta { font-size: 12px; color: var(--ink-soft); margin: 1px 4px; display: inline-flex; align-items: center; gap: 4px; }
.msg .meta canvas { image-rendering: pixelated; border-radius: 50%; background: var(--paper-2); }
.msg.cont .meta { display: none; }
.sys {
  align-self: center;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  padding: 2px 8px;
}
.divider { align-self: stretch; text-align: center; font-size: 12px; color: var(--peach-2); font-weight: 800; border-top: 2px dashed var(--paper-3); padding-top: 4px; margin-top: 4px; }
.empty-chat { margin: auto; text-align: center; color: var(--ink-soft); font-size: 14px; padding: 12px; }
.typing { min-height: 0; padding: 0 14px; font-size: 13px; color: var(--ink-soft); }
.typing:not(:empty) { padding-bottom: 4px; }

.chat-form { padding: 6px 8px 8px; border-top: 2px solid var(--paper-3); display: flex; flex-direction: column; gap: 6px; }
.reactions { display: flex; gap: 6px; }
.reactions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 2px solid var(--paper-3);
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.reactions button:hover { background: #fff; }
.reactions button:active { transform: translateY(1px); }
.reactions .r-heart, .reactions .r-hug { color: var(--rose); }
.reactions .r-wave, .reactions .r-clap, .reactions .r-more { color: #c88a2f; }
.reactions .label { display: none; }
.chat { container-type: inline-size; }
@container (min-width: 380px) { .reactions .label { display: inline; } }
.chat-row { display: flex; gap: 6px; }
#chat-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 16px;
}
#chat-input::placeholder { color: #a08e95; }
.send { min-width: 48px; padding: 0 12px; background: var(--peach); }
.btn.mic { min-width: 44px; padding: 0 10px; }
.btn.mic.on { background: #f7c1c3; }
.recorder { display: flex; align-items: center; gap: 8px; padding: 4px 2px 0; font-weight: 700; font-size: 14px; }
.recorder .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e0525e; animation: rec 1s infinite; flex: none; }
.recorder .rec-time { color: var(--ink-soft); font-variant-numeric: tabular-nums; margin-right: auto; }
@keyframes rec { 50% { opacity: 0.3; } }
.msg .text.voice { display: flex; align-items: center; gap: 8px; min-width: 170px; }
.msg .text.voice.gone { color: var(--ink-soft); font-style: italic; min-width: 0; }
.voice-play { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border: var(--line); border-radius: 50%; background: var(--peach); color: var(--ink); cursor: pointer; padding: 0; }
.voice-play .px-icon { width: 12px; height: 12px; }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 20px; flex: 1; }
.voice-wave i { display: block; width: 3px; border-radius: 2px; background: #c9a79a; }
.voice-wave i.on { background: var(--peach-2); }
.voice-len { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ decorate */

.decor-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
  padding: 10px;
  border: var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow-y: auto;
}
.decor-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.decor-hint { margin: 0; font-size: 14px; color: var(--ink-soft); }
.decor-selected { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border-radius: 8px; background: var(--paper-2); }
.decor-selected strong { flex-basis: 100%; font-size: 15px; }
.decor-selected .nudge { display: flex; gap: 4px; }
.decor-selected .nudge .btn { min-width: 40px; padding: 4px; }
.decor-selected .btn .px-icon { width: 14px; height: 14px; }
.tray { display: flex; flex-direction: column; gap: 10px; }
.tray-group h4 { margin: 0 0 4px; font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.tray-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.tray button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 2px solid var(--paper-3);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.tray button:hover:not(:disabled) { border-color: var(--peach); }
.tray button:disabled { opacity: 0.45; cursor: default; }
.tray img { height: 40px; width: auto; image-rendering: pixelated; }
.tray .count { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.tray img.swatch { width: 60px; height: 40px; border-radius: 4px; border: 1px solid rgba(59, 40, 48, 0.25); }
.tray button.on { border-color: var(--peach-2); background: #fff1e4; box-shadow: inset 0 0 0 1px var(--peach-2); }

/* ------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  z-index: 60;
  top: calc(64px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 15px;
  font-weight: 600;
  pointer-events: none; /* taps go through to the room; only buttons catch them */
  animation: toast-in 0.25s ease-out;
}
.toast button { pointer-events: auto; }
.toast .px-icon { color: var(--peach-2); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: 0.4s; }
.toast button { margin-left: auto; }
.toast-actions { display: flex; gap: 6px; margin-left: auto; flex: none; pointer-events: auto; }
.toast-actions .btn { margin: 0; }
.gesture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.gesture-grid .btn { justify-content: flex-start; min-height: 42px; }
.gesture-grid .btn.on { background: var(--gold); }
.gesture-grid .btn .px-icon { color: var(--peach-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ------------------------------------------------------------ modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(24, 16, 22, 0.62);
  animation: fade-in 0.15s;
}
@keyframes fade-in { from { opacity: 0; } }
.card {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 20px;
  border: var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 5px 0 rgba(20, 12, 18, 0.55);
}
.card h2 { margin: 0 0 6px; font-size: 21px; }
.card p { margin: 6px 0 12px; color: var(--ink-soft); }
.card .close { position: absolute; top: 10px; right: 10px; min-width: 40px; height: 40px; padding: 0; border: 0; box-shadow: none; background: transparent; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card .row .btn { flex: 1; }
.card label { display: block; font-weight: 800; margin: 10px 0 4px; }
.card input[type="text"], .card input[type="url"], .card textarea {
  width: 100%;
  padding: 10px 12px;
  border: var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 16px;
}
.card textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.link-box {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.link-box input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 14px !important;
  font-family: ui-monospace, Menlo, monospace !important;
}
.fine { font-size: 13px !important; color: var(--ink-soft); }
.card .row.center { justify-content: center; }
.card .row.center .btn { flex: 0 1 auto; }
.note-box { padding: 8px 12px; border-radius: 8px; background: var(--paper-2); color: var(--ink) !important; font-weight: 700; }
.section { border-top: 2px dashed var(--paper-3); margin-top: 16px; padding-top: 12px; }
.section h3 { margin: 0 0 4px; font-size: 16px; }
/* the team code: typed on the front page, shown to the lead in Invite */
.join-team { text-align: left; border-top: none; margin-top: 8px; padding: 12px; border-radius: 10px; background: var(--paper-2); }
.join-team .link-box input.code-input { font-size: 18px !important; letter-spacing: 0.12em; text-transform: uppercase; }
.code-problem { margin: 6px 0 0; color: var(--red, #c24f55) !important; font-weight: 700; }
.or-new { margin: 16px 0 0; font-size: 16px; text-align: left; }
.code-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.code-row.center { justify-content: center; }
.team-code-text { font: 700 26px/1.2 ui-monospace, Menlo, monospace; letter-spacing: 0.14em; padding: 6px 14px; border-radius: 8px; background: var(--paper-2); color: var(--ink); user-select: all; }

.slider { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; margin: 8px 0; font-weight: 700; }
.slider input { accent-color: var(--peach-2); width: 100%; }
.card .slider { display: grid; }
.slider.light { grid-template-columns: 110px 1fr; margin: 4px 0 0; }
.slider .light-name { font-weight: 800; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0; font-weight: 700; }

.choice-row { display: flex; gap: 6px; flex-wrap: wrap; }
.choice-row .btn { flex: 1; min-width: 90px; }
.choice-row .btn.on { background: var(--gold); }
.choice-row.two { display: grid; grid-template-columns: 1fr 1fr; }
.choice-row.two .btn { min-width: 0; }

/* desk styles, gifts */
.desk-styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.desk-style { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 2px solid var(--paper-3); border-radius: 8px; background: #fffdf8; color: var(--ink); font-weight: 700; font-size: 13px; cursor: pointer; }
.desk-style.on { border-color: var(--peach-2); background: #fff1e6; }
.desk-style canvas { width: 72px; height: auto; image-rendering: pixelated; }
.desk-style img { max-width: 72px; max-height: 64px; width: auto; height: auto; image-rendering: pixelated; }
.desk-styles.colors .desk-style img { min-height: 36px; object-fit: contain; }
.gift-pic { display: block; margin: 4px auto 8px; width: 96px; height: auto; image-rendering: pixelated; }
.gift-note { margin: 8px 0 4px; }
textarea.paper-input.small { min-height: 70px; }

.frame-arts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.frame-arts canvas { width: 48px; }
.wall-photo { display: block; max-width: 100%; max-height: 60vh; margin: 8px auto; border: var(--line); border-radius: 6px; image-rendering: auto; }

/* uno */
.card.uno-modal { width: min(560px, 100%); }
.uno-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-right: 40px; }
.uno-score { margin: 0 !important; font-weight: 800; color: var(--ink) !important; }
.uno-rules { margin: 4px 0 8px; padding-left: 18px; }
.uno-theirs { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.uno-backs { display: flex; }
.uno-backs .uno-card { margin-right: -18px; }
.uno-pile { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 4px; }
.uno-card {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 76px; flex: none; border: var(--line); border-radius: 8px;
  background: #fff6e8; color: #fff; font-weight: 900; font-size: 22px; line-height: 1;
  box-shadow: 0 3px 0 rgba(20, 12, 18, 0.45); padding: 0; font-family: inherit;
}
.uno-card .mid { display: flex; align-items: center; justify-content: center; width: 38px; height: 54px; border-radius: 50% / 40%; background: rgba(255, 255, 255, 0.92); transform: rotate(-12deg); }
.uno-card .mid { color: var(--ink); }
.uno-card .corner { position: absolute; top: 3px; left: 5px; font-size: 12px; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.uno-card.c-r { background: #e36f73; } .uno-card.c-r .mid { color: #c55357; }
.uno-card.c-y { background: #f0bf4c; } .uno-card.c-y .mid { color: #b98a1f; }
.uno-card.c-g { background: #74b27a; } .uno-card.c-g .mid { color: #4f8a55; }
.uno-card.c-b { background: #6f95c0; } .uno-card.c-b .mid { color: #4f74a0; }
.uno-card.c-w, .uno-card.wild { background: conic-gradient(#e36f73 0 25%, #f0bf4c 0 50%, #74b27a 0 75%, #6f95c0 0); }
.uno-card.c-w .mid, .uno-card.wild .mid { color: var(--ink); }
.uno-card.back { background: #3b2830; background-image: repeating-linear-gradient(45deg, rgba(255, 246, 232, 0.08) 0 4px, transparent 4px 8px); color: #f07f95; font-size: 22px; }
.uno-card.back.small { font-size: 13px; }
.uno-card.small { width: 30px; height: 44px; font-size: 9px; border-radius: 6px; }
.uno-card.deck { cursor: pointer; }
.uno-card.deck:disabled { opacity: 0.7; cursor: default; }
button.uno-card { cursor: pointer; transition: transform 0.08s; }
button.uno-card:not(:disabled):hover { transform: translateY(-4px); }
button.uno-card:disabled { filter: saturate(0.45) brightness(0.93); opacity: 0.8; cursor: default; }
.uno-color { padding: 4px 10px; border-radius: 999px; border: var(--line); font-weight: 800; font-size: 13px; color: #fff; text-transform: capitalize; }
.uno-color.c-r { background: #e36f73; } .uno-color.c-y { background: #f0bf4c; color: var(--ink); } .uno-color.c-g { background: #74b27a; } .uno-color.c-b { background: #6f95c0; }
.uno-status { text-align: center; font-weight: 800; margin: 6px 0 2px !important; color: var(--ink-soft) !important; }
.uno-status.mine { color: var(--peach-2) !important; }
.uno-last { text-align: center; margin: 0 0 6px !important; }
.uno-hand { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0; }
.uno-pick { display: flex; align-items: center; gap: 8px; justify-content: center; font-weight: 800; margin: 6px 0; }
.uno-swatch { width: 36px; height: 36px; border: var(--line); border-radius: 50%; cursor: pointer; }
.uno-swatch.c-r { background: #e36f73; } .uno-swatch.c-y { background: #f0bf4c; } .uno-swatch.c-g { background: #74b27a; } .uno-swatch.c-b { background: #6f95c0; }

/* notes */
.paper {
  position: relative;
  padding: 18px 18px 14px;
  border: var(--line);
  border-radius: 4px;
  background: #fff4c9;
  background-image: repeating-linear-gradient(transparent 0 25px, rgba(59, 40, 48, 0.12) 25px 26px);
  color: var(--ink);
  font-size: 17px;
  line-height: 26px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 0 rgba(20, 12, 18, 0.35);
  transform: rotate(-0.6deg);
}
.paper.p1 { background-color: #ffd8e1; }
.paper.p2 { background-color: #d7ecff; }
.paper.p3 { background-color: #dff2d3; }
.paper .from { display: block; margin-top: 8px; text-align: right; font-weight: 800; color: var(--ink-soft); font-size: 14px; }
.paper .magnet { position: absolute; top: -8px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--rose); border: var(--line); }
.note-list { display: flex; flex-direction: column; gap: 14px; margin: 12px 0; }
.note-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.papers { display: flex; gap: 8px; }
.papers button { width: 36px; height: 36px; border: var(--line); border-radius: 6px; cursor: pointer; }
.papers button.on { outline: 3px solid var(--peach-2); outline-offset: 2px; }
.paper.letter {
  background: #fffaf2;
  background-image: none;
  border-radius: 6px;
  padding: 22px 20px 14px;
  font-style: italic;
  transform: rotate(0.4deg);
}
.paper.letter .seal {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  background: var(--rose);
  border: var(--line);
}
.paper.letter .seal::after { content: '\2665'; position: absolute; inset: 0; color: #fff; font-size: 12px; line-height: 17px; text-align: center; font-style: normal; }
textarea.letter-input { background: #fffaf2 !important; background-image: none !important; font-style: italic; }
textarea.paper-input { background: #fff4c9; background-image: repeating-linear-gradient(transparent 0 25px, rgba(59, 40, 48, 0.12) 25px 26px); line-height: 26px; font-size: 17px; }

/* ------------------------------------------------------------ screens */

.screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 20%, #3d4556 0%, var(--bg) 65%);
}
.screen .card { margin: auto 0; width: min(520px, 100%); }
.screen .stack .card { margin: 0; }
.hero { text-align: center; }
.hero canvas { width: min(100%, 360px); image-rendering: pixelated; margin: 4px auto 8px; display: block; border-radius: 8px; }
.hero h1 { margin: 6px 0 2px; font-size: 30px; letter-spacing: 0.5px; }
.hero .tag-line { margin: 0 0 14px; color: var(--ink-soft); font-size: 17px; }
.steps { text-align: left; margin: 12px 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.steps .px-icon { color: var(--peach-2); margin-top: 3px; }

.creator { display: grid; gap: 12px; }
.creator .preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: #d9a57a;
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 16px);
}
.creator .preview canvas { image-rendering: pixelated; }
.creator .turn { min-width: 40px; }
.opt { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 8px; }
.opt > span { font-weight: 800; font-size: 15px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button {
  width: 34px;
  height: 34px;
  border: var(--line);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(20, 12, 18, 0.35);
}
.swatches button.on { outline: 3px solid var(--peach-2); outline-offset: 2px; }
.swatches button canvas { display: block; margin: auto; image-rendering: pixelated; }
.swatches button:has(canvas) { width: auto; min-width: 34px; height: auto; min-height: 34px; padding: 2px; background: #fffdf8; }
.creator .opt .choice-row .btn { min-width: 0; flex: 1 1 auto; }
.creator .things .opt { margin-top: 8px; }
.creator .things input[type="text"] { margin: 0; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .val { flex: 1; text-align: center; font-weight: 800; background: var(--paper-2); border-radius: 8px; padding: 8px; }
.stepper .btn { min-width: 44px; padding: 0; }

.noscript { color: var(--paper); text-align: center; margin-top: 40vh; }

@media (max-width: 859px) {
  .person.me .who { display: none; }
  .person.me { padding: 3px; }
  .toasts { top: auto; bottom: calc(130px + var(--safe-b)); gap: 4px; }
  .toast { padding: 6px 12px; font-size: 14px; }
  .toast .btn { min-height: 32px; }
}

@media (max-width: 420px) {
  .opt { grid-template-columns: 1fr; gap: 4px; }
  .hud { padding: 8px 8px 4px; }
  .hud-buttons { gap: 6px; }
  .icon-btn { min-width: 40px; height: 40px; padding: 0 8px; }
  .person { padding-right: 10px; }
  .person .name { max-width: 7em; }
}

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


/* ------------------------------------------------------------ the office */

.tag.me { background: rgba(58, 74, 96, 0.8); }
.tag.talking { box-shadow: 0 0 0 2px #7fcf7a; }
.btn.tiny { min-height: 30px; padding: 2px 8px; font-size: 13px; box-shadow: 0 2px 0 rgba(20, 12, 18, 0.45); gap: 4px; }
.btn.tiny .px-icon { width: 12px; height: 12px; }
.btn.on { background: var(--gold); }
.stack { display: grid; gap: 14px; width: min(520px, 100%); margin: auto 0; }
.card.wide { width: min(980px, 100%); }
.card h4 { margin: 10px 0 4px; font-size: 14px; color: var(--ink-soft); }
.card select, .card input[type="url"], .card input[type="date"], .card input[type="time"] {
  min-height: 40px; padding: 6px 8px; border: var(--line); border-radius: var(--radius); background: #fffdf8; color: var(--ink); font: inherit;
}
.with-icon { display: flex; align-items: center; gap: 6px; }
.with-icon .px-icon { color: #c89a2a; }
.chip { display: inline-block; padding: 2px 10px; margin: 2px; border-radius: 999px; background: var(--paper-2); font-weight: 700; font-size: 14px; }
.uno-lobby { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0; }
.uno-other { padding: 4px 8px; border-radius: 8px; }
.uno-other.turn { background: #fff1c9; }

.meeting-bar {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; max-width: calc(100% - 24px);
  border: var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font-weight: 700; font-size: 14px; box-shadow: var(--shadow);
}
.meeting-bar .mt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meeting-now { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border-radius: 10px; background: #fff1e6; font-weight: 800; }

/* the task board */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
@media (max-width: 700px) { .kanban { grid-template-columns: minmax(0, 1fr); } }
.kcol { background: var(--paper-2); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.kcol h3 { margin: 0 2px 2px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.kcol .count { font-size: 12px; background: #fff; border-radius: 999px; padding: 0 8px; }
.kcards { display: flex; flex-direction: column; gap: 6px; max-height: 48vh; overflow-y: auto; }
.kcard { position: relative; padding: 8px 8px 6px; border: 2px solid rgba(59, 40, 48, 0.25); border-radius: 6px; background: #fff4c9; box-shadow: 0 2px 0 rgba(20, 12, 18, 0.18); }
.kcard.p1 { background: #ffd8e1; } .kcard.p2 { background: #d7ecff; } .kcard.p3 { background: #dff2d3; }
.kcard p { margin: 0 0 6px; color: var(--ink); font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.kmeta { display: flex; align-items: center; gap: 6px; }
.kmeta canvas { image-rendering: pixelated; border-radius: 50%; background: #fff; }
.kmeta select { min-height: 28px; padding: 1px 4px; font-size: 12px; max-width: 100%; }
.kacts { display: flex; gap: 4px; margin-top: 6px; justify-content: flex-end; }
.k-done .kcard p { text-decoration: line-through; text-decoration-color: rgba(59, 40, 48, 0.4); }
.kadd { display: flex; gap: 4px; }
.kadd input { flex: 1; min-width: 0; min-height: 34px !important; padding: 4px 8px !important; font-size: 14px; }

/* meetings */
.cal-list { display: flex; flex-direction: column; gap: 6px; }
.cal-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 10px; background: var(--paper-2); }
.cal-row.soon { background: #fff1c9; }
.cal-when, .cal-what { display: flex; flex-direction: column; min-width: 0; }
.cal-what .agenda { white-space: pre-wrap; }
.cal-acts { display: flex; gap: 4px; align-items: center; }
@media (max-width: 600px) { .cal-row { grid-template-columns: minmax(0, 1fr) auto; } .cal-when { grid-column: 1 / -1; } }
.cal-fields { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cal-form textarea.small-area, textarea.minutes { min-height: 80px; }
textarea.minutes { min-height: 200px; font-size: 15px; }

/* the team */
.team-list { display: flex; flex-direction: column; gap: 8px; }
.team-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 8px; border-radius: 10px; background: var(--paper-2); }
.team-row canvas { image-rendering: pixelated; border-radius: 50%; background: #fff; }
.team-info { display: flex; flex-direction: column; min-width: 0; }
.team-info strong { display: flex; align-items: center; gap: 4px; }
.team-info .px-icon { width: 14px; height: 14px; color: #c89a2a; }
.team-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.team-acts .link-box { flex-basis: 100%; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pick { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 2px solid var(--paper-3); border-radius: 8px; background: #fffdf8; color: var(--ink); font-weight: 700; cursor: pointer; text-align: left; flex-wrap: wrap; }
.pick canvas { image-rendering: pixelated; border-radius: 50%; }
.pick.on { border-color: var(--peach-2); }

/* the whiteboard */
.wb-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.wb-swatch { width: 30px; height: 30px; border: var(--line); border-radius: 50%; cursor: pointer; }
.wb-swatch.on { outline: 3px solid var(--peach-2); outline-offset: 2px; }
.wb-canvas { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 560; border: var(--line); border-radius: 8px; background: #fbfaf6; touch-action: none; cursor: crosshair; }
.share-big { display: block; width: 100%; max-height: 70vh; background: #000; border-radius: 8px; }
.paper.hidden-note { font-style: italic; color: var(--ink-soft); }
.desk-styles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.btn.armed { background: #f7c1c3; }
.kcard input.kedit { width: 100%; min-height: 32px !important; margin-bottom: 6px; padding: 4px 6px !important; font-weight: 700; font-size: 14px; }
