:root {
  --bg: #f7ead8;
  --wall: #f2d9bd;
  --ink: #3b2a24;
  --muted: #7f6455;
  --panel: #fff6e8;
  --panel-strong: #fffaf1;
  --line: #6f5143;
  --shadow: #c68d6d;
  --red: #cf6f5b;
  --blue: #5f91a5;
  --green: #7b9c6f;
  --gold: #d7a84d;
  --pink: #e8a8a0;
  --cream: #fffdf5;
  --pixel: 4px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(111, 81, 67, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(111, 81, 67, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

#app {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

#app.locked {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  width: min(520px, 100%);
  padding: 24px;
  background: var(--panel-strong);
  border: 3px solid var(--line);
  box-shadow: 8px 8px 0 var(--shadow);
}

.auth-copy {
  margin: 12px 0 16px;
  color: var(--muted);
  line-height: 1.65;
}

.auth-form,
.auth-mode-fields {
  display: grid;
  gap: 12px;
}

.auth-identity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-tabs {
  margin-bottom: 14px;
}

.hidden {
  display: none !important;
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: #a53d30;
  font-size: 13px;
  font-weight: 800;
}

.pin-note {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.auth-status {
  align-self: end;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  border: 2px solid var(--line);
  background: #d9efe5;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.18);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 20px;
  background: var(--panel-strong);
  border: 3px solid var(--line);
  box-shadow: 6px 6px 0 var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(26px, 4vw, 42px);
}

h2 {
  font-size: 18px;
}

.subline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.room-meta,
.composer-row,
.composer-actions,
.panel-head,
.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  padding: 9px 10px;
  outline: none;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.18);
}

textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.6;
}

.input-shell {
  position: relative;
}

.input-shell textarea {
  padding-right: 96px;
}

.input-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 92px;
  padding: 5px 7px;
  border: 2px solid var(--line);
  background: #fff0c9;
  color: #5f4539;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 2px 2px 0 rgba(111, 81, 67, 0.16);
}

.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(111, 81, 67, 0.24);
  border-top-color: var(--line);
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.scene-panel,
.card {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 6px 6px 0 var(--shadow);
}

.scene-panel {
  padding: 18px;
}

.side-stack {
  display: contents;
}

.card {
  padding: 16px;
}

.round-card,
.menu-card,
.memory-card,
.private-card {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 60;
  width: min(520px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  display: none;
}

.round-card.open,
.menu-card.open,
.memory-card.open,
.private-card.open {
  display: block;
}

.private-card {
  top: auto;
  bottom: 24px;
}

.secret-menu {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 2px dashed #b98563;
  background: #fff5dc;
}

.menu-card {
  width: min(760px, calc(100vw - 48px));
}

.book-menu {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px 14px 14px 24px;
  border: 3px solid var(--line);
  background:
    linear-gradient(90deg, rgba(111, 81, 67, 0.12) 0 1px, transparent 1px 12px),
    #fff6df;
  box-shadow:
    inset 0 0 0 4px #f2d39d,
    4px 4px 0 rgba(111, 81, 67, 0.14);
}

.book-spine {
  position: absolute;
  left: 9px;
  top: 9px;
  bottom: 9px;
  width: 8px;
  border-left: 3px solid var(--line);
  border-right: 2px dashed rgba(111, 81, 67, 0.38);
  background: #d99a67;
}

.book-page {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 2px solid #9e755d;
  background:
    linear-gradient(180deg, rgba(215, 168, 77, 0.12) 0 1px, transparent 1px 26px),
    #fffaf0;
  box-shadow: inset 0 -5px 0 rgba(215, 168, 77, 0.14);
}

.menu-page {
  gap: 10px;
}

.menu-page + .menu-page {
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(127, 183, 158, 0.12) 0 1px, transparent 1px 28px),
    #fffdf5;
}

.menu-page-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.menu-page-head strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

.menu-page-nav {
  display: flex;
  gap: 6px;
}

.menu-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.menu-item-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff8ea;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.12);
}

.menu-empty {
  grid-column: 1 / -1;
  padding: 16px;
  border: 2px dashed #b98563;
  border-radius: 14px;
  background: #fff8ea;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.menu-item-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.menu-item-head strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.menu-item-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  word-break: normal;
  overflow-wrap: anywhere;
}

.menu-item-recipe {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fffdf5;
  border: 1px solid rgba(111, 81, 67, 0.16);
  line-height: 1.55;
}

.menu-item-recipe span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.menu-item-recipe p {
  margin: 0;
  color: #5f4539;
  font-size: 12px;
  word-break: normal;
  overflow-wrap: anywhere;
}

.menu-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.menu-tip {
  padding: 12px;
  border: 2px dashed #b98563;
  border-radius: 14px;
  background: #fff8ea;
  color: #6b4c3f;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}

.secret-menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.secret-menu-head span {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.secret-drink {
  padding: 10px;
  border: 2px solid var(--line);
  background: #fffaf0;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.12);
  line-height: 1.6;
}

.secret-drink-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 900;
}

.secret-drink-cup {
  width: 38px;
  height: 30px;
  border: 3px solid var(--line);
  border-top: 0;
  background: linear-gradient(#fff8ea 0 30%, #f6be72 31% 100%);
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.45);
}

.custom-treat-form {
  display: grid;
  gap: 8px;
}

.treat-message {
  background: #fff7de;
}

.game-message {
  background: #f2f6ff;
}

.item-message {
  background: #fff0fb;
}

.treat-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 2px solid var(--line);
  background: #fffaf0;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.12);
}

.game-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--line);
  background: #f8fbff;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.12);
}

.item-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--line);
  background: #fff8fd;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.12);
}

.item-card-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
}

.item-card-head strong {
  display: block;
  font-size: 15px;
}

.item-card-head span:not(.item-icon) {
  color: var(--muted);
  font-size: 12px;
}

.item-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  background: #ffe2f3;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.55);
  font-size: 21px;
}

.game-card-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
}

.game-card-head strong {
  display: block;
  font-size: 15px;
}

.game-card-head span:not(.game-dice) {
  color: var(--muted);
  font-size: 12px;
}

.game-dice {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  background: #fff5dc;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.55);
  font-size: 21px;
}

.game-choice {
  padding: 8px;
  border: 2px dashed #b7a0cb;
  background: #fff;
  line-height: 1.55;
}

.treat-card-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
}

.treat-card-head strong {
  display: block;
  font-size: 15px;
}

.treat-card-head span:not(.treat-icon) {
  color: var(--muted);
  font-size: 12px;
}

.treat-icon {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 34px;
  border: 3px solid var(--line);
  background: #f7c66f;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.35);
}

.treat-icon i,
.treat-icon b {
  position: absolute;
  display: block;
  content: "";
}

.treat-icon-cocoa,
.treat-icon-tea {
  border-top: 0;
  border-radius: 0 0 7px 7px;
}

.treat-icon-cocoa::after,
.treat-icon-tea::after {
  content: "";
  position: absolute;
  right: -12px;
  top: 8px;
  width: 10px;
  height: 12px;
  border: 3px solid var(--line);
  border-left: 0;
  border-radius: 0 9px 9px 0;
}

.treat-icon-lime,
.treat-icon-orange {
  border-radius: 50%;
}

.treat-icon-lime {
  background: #b9d873;
}

.treat-icon-orange {
  background: #f0a34d;
}

.treat-icon-mint {
  width: 34px;
  border-radius: 18px 18px 6px 18px;
  background: #91cda5;
  transform: rotate(-18deg);
}

.treat-icon-pad {
  width: 42px;
  border-radius: 18px;
  background: #fff8ee;
}

.treat-icon-pad i {
  left: -8px;
  top: 10px;
  width: 10px;
  height: 12px;
  border: 2px solid var(--line);
  background: #fff8ee;
}

.treat-icon-pad b {
  right: -8px;
  top: 10px;
  width: 10px;
  height: 12px;
  border: 2px solid var(--line);
  background: #fff8ee;
}

.treat-icon-pudding {
  border-radius: 16px 16px 6px 6px;
  background: #ffd887;
}

.treat-icon-dish {
  width: 42px;
  height: 26px;
  margin-top: 6px;
  border-radius: 50%;
  background: #ffe2a5;
}

.screen-effects {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden;
}

.screen-effects span {
  position: absolute;
  top: -40px;
  font-size: 26px;
  filter: drop-shadow(2px 2px 0 rgba(111, 81, 67, 0.18));
  animation: float-cool linear forwards;
}

@keyframes float-cool {
  0% {
    transform: translateY(-60px) rotate(-8deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    transform: translateY(calc(100vh + 80px)) rotate(18deg);
    opacity: 0;
  }
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.scene-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.more-tools {
  position: relative;
}

.more-tools-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  display: grid;
  gap: 7px;
  min-width: 132px;
  padding: 8px;
  border: 2px solid var(--line);
  background: var(--panel-strong);
  box-shadow: 4px 4px 0 rgba(111, 81, 67, 0.24);
}

.more-tool-item {
  min-height: 34px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff2d6;
  padding: 7px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 2px 2px 0 rgba(111, 81, 67, 0.18);
}

.pixel-tool,
.mode-btn {
  min-height: 36px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #d9efe5;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.2);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.comfort-switch {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 6px;
}

.comfort-switch .mode-btn {
  min-height: 30px;
  padding: 5px 6px;
  white-space: nowrap;
  font-size: 12px;
}

.mode-btn.active {
  background: #ffd071;
}

.visibility-current {
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff0c9;
  color: #5f4539;
  font-size: 13px;
  font-weight: 900;
}

.card-close {
  width: 34px;
  min-height: 34px;
  padding: 4px;
}

.panel-head.compact {
  align-items: start;
}

.stage-pill {
  min-width: 86px;
  padding: 7px 10px;
  border-radius: 999px;
  text-align: center;
  border: 2px solid var(--line);
  background: #fee3b7;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.2);
}

.dining-scene {
  position: relative;
  min-height: 298px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 244, 190, 0.9) 0 18px, transparent 19px),
    radial-gradient(circle at 83% 20%, rgba(167, 205, 179, 0.65) 0 22px, transparent 23px),
    linear-gradient(180deg, #f3cf9f 0 54%, #dca577 54% 100%);
  border: 3px solid var(--line);
  box-shadow:
    inset 0 -12px 0 rgba(82, 53, 43, 0.14),
    inset 0 9px 0 rgba(255, 247, 218, 0.45);
}

.scene-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, transparent 0 34px, rgba(111, 81, 67, 0.12) 34px 37px, transparent 37px 100%),
    linear-gradient(180deg, transparent 0 84px, rgba(111, 81, 67, 0.1) 84px 87px, transparent 87px 100%);
  background-size: 74px 100%, 100% 128px;
  opacity: 0.42;
}

.scene-garland {
  position: absolute;
  top: 18px;
  left: 18%;
  right: 18%;
  z-index: 2;
  height: 42px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.scene-garland::before {
  content: "";
  position: absolute;
  left: -5px;
  right: -5px;
  top: 10px;
  height: 18px;
  border-top: 3px solid rgba(111, 81, 67, 0.56);
  border-radius: 50%;
}

.scene-garland span {
  position: relative;
  width: 13px;
  height: 18px;
  margin-top: 17px;
  background: #ffd36e;
  border: 2px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgba(255, 247, 207, 0.38);
  animation: garlandGlow 2.8s steps(2) infinite;
}

.scene-garland span:nth-child(2n) {
  background: #9fd4ca;
  animation-delay: 0.4s;
}

.scene-garland span:nth-child(3n) {
  background: #f7a49b;
  animation-delay: 0.8s;
}

.scene-frame {
  position: absolute;
  top: 104px;
  z-index: 1;
  width: 54px;
  height: 46px;
  background: #fff4d3;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(111, 81, 67, 0.15);
}

.scene-frame::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 10px;
  width: 25px;
  height: 19px;
  background:
    linear-gradient(135deg, transparent 45%, #74a889 46% 62%, transparent 63%),
    radial-gradient(circle at 70% 30%, #f6c15f 0 5px, transparent 6px),
    #a8d7d1;
  border: 2px solid rgba(111, 81, 67, 0.5);
}

.frame-left {
  left: 152px;
  transform: rotate(-2deg);
}

.frame-right {
  right: 138px;
  transform: rotate(2deg);
}

.scene-shelf {
  position: absolute;
  top: 86px;
  right: 28px;
  z-index: 1;
  width: 114px;
  height: 18px;
  background: #a96b43;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(111, 81, 67, 0.14);
}

.scene-shelf::before {
  content: "";
  position: absolute;
  left: 11px;
  top: -35px;
  width: 24px;
  height: 30px;
  background: #7fb79e;
  border: 3px solid var(--line);
  box-shadow:
    37px 7px 0 -1px #f4d071,
    37px 7px 0 2px var(--line),
    73px 0 0 -1px #f39a8e,
    73px 0 0 2px var(--line);
}

.scene-shelf i {
  position: absolute;
  bottom: -16px;
  width: 8px;
  height: 16px;
  background: #7f4b38;
  border: 2px solid var(--line);
}

.scene-shelf i:first-child {
  left: 18px;
}

.scene-shelf i:nth-child(2) {
  left: 52px;
}

.scene-shelf i:nth-child(3) {
  right: 18px;
}

.scene-plant {
  position: absolute;
  right: 24px;
  bottom: 20px;
  z-index: 1;
  width: 48px;
  height: 54px;
  background: #bc7351;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(111, 81, 67, 0.14);
}

.scene-plant::before,
.scene-plant::after {
  content: "";
  position: absolute;
  bottom: 42px;
  background: #6ba777;
  border: 3px solid var(--line);
}

.scene-plant::before {
  left: -6px;
  width: 26px;
  height: 42px;
  transform: rotate(-15deg);
}

.scene-plant::after {
  right: -5px;
  width: 29px;
  height: 48px;
  transform: rotate(15deg);
}

.scene-rug {
  position: absolute;
  left: 50%;
  bottom: 6px;
  z-index: 1;
  width: min(560px, 84%);
  height: 54px;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.34) 0 17px, transparent 17px 34px),
    #db8e7f;
  border: 3px solid rgba(111, 81, 67, 0.72);
  border-radius: 50%;
  opacity: 0.78;
}

.window-pixels {
  position: absolute;
  top: 24px;
  left: 32px;
  z-index: 1;
  width: 96px;
  height: 72px;
  background:
    linear-gradient(90deg, transparent 45%, var(--line) 45% 55%, transparent 55%),
    linear-gradient(180deg, transparent 45%, var(--line) 45% 55%, transparent 55%),
    #9ed1d0;
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 rgba(111, 81, 67, 0.16);
}

.table {
  position: absolute;
  left: 50%;
  bottom: 20px;
  z-index: 3;
  width: min(520px, 78%);
  height: 96px;
  transform: translateX(-50%);
  border: 3px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.32) 0 12px, transparent 12px 26px),
    linear-gradient(180deg, rgba(255, 223, 176, 0.32), transparent 48%),
    #a8684a;
  border-radius: 18px 18px 8px 8px;
  box-shadow:
    0 16px 0 #7f4b38,
    0 20px 0 rgba(76, 46, 36, 0.18);
}

.table::before,
.table::after {
  content: "";
  position: absolute;
  bottom: -48px;
  width: 28px;
  height: 50px;
  background: #6f3f32;
  border: 3px solid var(--line);
}

.table::before {
  left: 52px;
}

.table::after {
  right: 52px;
}

.plate {
  position: absolute;
  top: 34px;
  width: 58px;
  height: 18px;
  border: 3px solid var(--line);
  background: #fef5df;
  box-shadow: inset 0 -4px 0 #e2c9a9;
}

.plate-a {
  left: 90px;
}

.plate-b {
  right: 90px;
}

.steam {
  position: absolute;
  top: 8px;
  width: 6px;
  height: 24px;
  background: rgba(255, 255, 255, 0.6);
  animation: steam 1.5s ease-in-out infinite;
}

.steam.one {
  left: 47%;
}

.steam.two {
  left: 52%;
  animation-delay: 0.4s;
}

.pixel-person,
.pixel-bear,
.letter-avatar {
  position: absolute;
  width: 76px;
  height: 120px;
  image-rendering: pixelated;
}

.pixel-person.left {
  left: clamp(24px, 12vw, 150px);
  bottom: 86px;
  z-index: 4;
  filter: drop-shadow(5px 8px 0 rgba(93, 61, 49, 0.13));
  animation: personFloat 2.4s steps(2) infinite;
}

.pixel-person.right {
  right: clamp(24px, 12vw, 150px);
  bottom: 86px;
  z-index: 4;
  filter: drop-shadow(5px 8px 0 rgba(93, 61, 49, 0.13));
  animation: personFloat 2.6s steps(2) infinite;
}

.pixel-person .face,
.letter-avatar .face {
  position: absolute;
  left: 10px;
  top: 20px;
  width: 56px;
  height: 50px;
  background: var(--animal-face, #f5b4a6);
  border: 3px solid var(--line);
  box-shadow: inset -6px -6px 0 rgba(90, 55, 45, 0.12);
}

.pixel-person .body,
.letter-avatar .body {
  position: absolute;
  left: 16px;
  top: 68px;
  width: 44px;
  height: 48px;
  background: var(--animal-body, #d96f61);
  border: 3px solid var(--line);
}

.ear {
  position: absolute;
  top: 4px;
  width: 22px;
  height: 24px;
  background: var(--animal-ear, #f5b4a6);
  border: 3px solid var(--line);
}

.left-ear {
  left: 9px;
}

.right-ear {
  right: 9px;
}

.eye {
  position: absolute;
  top: 18px;
  width: 7px;
  height: 7px;
  background: var(--ink);
}

.eye:first-child {
  left: 15px;
}

.eye:nth-child(2) {
  right: 15px;
}

.nose {
  position: absolute;
  left: 25px;
  top: 30px;
  width: 8px;
  height: 6px;
  background: var(--line);
}

.nameplate {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  min-width: 48px;
  padding: 2px 6px;
  background: var(--cream);
  border: 2px solid var(--line);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.pixel-bear {
  left: 50%;
  bottom: 98px;
  z-index: 5;
  transform: translateX(-50%);
  filter: drop-shadow(4px 8px 0 rgba(93, 61, 49, 0.13));
  animation: bearIdle 1.5s steps(2) infinite;
}

.pixel-bear.serving .dish {
  animation: serveDish 0.8s steps(4);
}

.bear-face {
  position: absolute;
  left: 8px;
  top: 16px;
  width: 60px;
  height: 54px;
  background: #c78a56;
  border: 3px solid var(--line);
  box-shadow: inset -6px -6px 0 rgba(80, 46, 32, 0.16);
}

.bear-ear {
  position: absolute;
  top: 2px;
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  background: #bd7f4d;
}

.bear-face span {
  position: absolute;
  top: 18px;
  width: 7px;
  height: 7px;
  background: var(--ink);
}

.bear-face span:first-child {
  left: 15px;
}

.bear-face span:nth-child(2) {
  right: 15px;
}

.bear-face b {
  position: absolute;
  left: 25px;
  top: 31px;
  width: 10px;
  height: 7px;
  background: #5b382d;
}

.bear-body {
  position: absolute;
  left: 14px;
  top: 68px;
  width: 48px;
  height: 48px;
  background: #a96b43;
  border: 3px solid var(--line);
}

.dish {
  position: absolute;
  left: 10px;
  top: 84px;
  width: 58px;
  height: 22px;
  background:
    radial-gradient(circle at 50% -4px, #f7b85e 0 13px, transparent 14px),
    #fdf2d3;
  border: 3px solid var(--line);
  border-radius: 999px;
  z-index: 2;
}

.dish span {
  position: absolute;
  left: 14px;
  top: -12px;
  width: 24px;
  height: 18px;
  background:
    radial-gradient(circle at 70% 28%, #fff6cd 0 3px, transparent 4px),
    var(--gold);
  border: 3px solid var(--line);
  border-radius: 8px 8px 5px 5px;
}

.visibility-note,
.small-note {
  margin: 12px 0;
  padding: 10px 12px;
  color: #5f4539;
  background: #ffe9bf;
  border: 2px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.return-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  color: #536b4d;
  background: #eef8df;
  border: 2px solid #9dbd95;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.65;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.12);
}

.private-note {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 12px 0;
  padding: 10px 12px;
  color: #5f4539;
  background: #ffe9bf;
  border: 2px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.tone-note {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 8px 0 10px;
  padding: 10px 12px;
  color: #5f4539;
  background: #fff0c9;
  border: 2px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.note-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  justify-content: space-between;
}

.note-text {
  min-width: 0;
  flex: 1;
}

.note-close {
  flex: none;
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 2px 2px 0 rgba(111, 81, 67, 0.16);
}

.note-close:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(111, 81, 67, 0.16);
}

.message-log {
  display: grid;
  gap: 10px;
  min-height: 240px;
  max-height: 430px;
  overflow: auto;
  padding: 4px;
}

.message {
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.16);
}

.message.a {
  border-left: 8px solid var(--red);
}

.message.b {
  border-left: 8px solid var(--blue);
}

.message.mediator {
  border-left: 8px solid var(--gold);
  background: #fff0c9;
}

.message.comforter {
  border-left: 8px solid var(--green);
}

.message-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 6px;
}

.message-body {
  white-space: pre-wrap;
  line-height: 1.72;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.question-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.option-chip,
.tab,
.primary-btn,
.secondary-btn,
.icon-text-btn {
  min-height: 36px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--cream);
  padding: 8px 11px;
  font-weight: 900;
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.22);
}

.primary-btn {
  background: #ffd071;
}

.secondary-btn {
  background: #fff2d6;
}

.icon-text-btn {
  background: #d9efe5;
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-text-btn:hover,
.option-chip:hover,
.more-tool-item:hover,
.tab:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(111, 81, 67, 0.22);
}

.full {
  width: 100%;
}

.composer {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.composer-row {
  align-items: stretch;
}

.composer-row select {
  flex: 1;
}

.composer-actions {
  justify-content: flex-end;
}

.composer-actions.wrap {
  flex-wrap: wrap;
}

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.letter-scene {
  position: relative;
  height: 148px;
  overflow: hidden;
  background: #d8b493;
  border: 3px solid var(--line);
}

.desk {
  position: absolute;
  inset: auto 18px 18px;
  height: 42px;
  background: #956149;
  border: 3px solid var(--line);
  box-shadow: 0 10px 0 #6f3f32;
}

.letter-avatar {
  left: 52px;
  top: 20px;
  transform: scale(0.82);
  transform-origin: top left;
  animation: writeBob 1.2s steps(2) infinite;
}

.pen {
  position: absolute;
  left: 54px;
  top: 88px;
  width: 26px;
  height: 6px;
  background: #3f5f8f;
  border: 2px solid var(--line);
  transform: rotate(18deg);
}

.paper {
  position: absolute;
  right: 46px;
  bottom: 34px;
  width: 96px;
  height: 68px;
  background: var(--cream);
  border: 3px solid var(--line);
}

.paper span {
  display: block;
  width: 70%;
  height: 5px;
  margin: 11px auto 0;
  background: #d5a78d;
}

.private-log {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 2px;
}

.tabs {
  margin: 8px 0 12px;
}

.tab {
  flex: 1;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.tab.active {
  background: #ffd071;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 10px;
}

.memory-box,
.profile-item {
  padding: 12px;
  border: 2px solid var(--line);
  background: var(--cream);
  line-height: 1.7;
  white-space: pre-wrap;
}

.profile-list {
  display: grid;
  gap: 8px;
}

.profile-form {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--line);
  background: #fff5dc;
}

.profile-item {
  display: grid;
  gap: 6px;
}

.profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-head {
  display: grid;
  grid-template-columns: 1fr minmax(130px, 0.9fr);
  gap: 8px;
  align-items: center;
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.round-history {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 2px;
}

.round-item {
  padding: 10px;
  border: 2px solid var(--line);
  background: var(--cream);
  box-shadow: 3px 3px 0 rgba(111, 81, 67, 0.14);
}

.round-item.active {
  background: #fff0c9;
}

.round-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.round-title-line span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.round-item p {
  margin: 0 0 8px;
  color: #5f4539;
  font-size: 12px;
  line-height: 1.55;
}

.mini {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.profile-tag {
  width: fit-content;
  padding: 2px 6px;
  background: #d9efe5;
  border: 2px solid var(--line);
  font-size: 11px;
  font-weight: 900;
}

.draft-box {
  margin-top: 10px;
  padding: 10px;
  border: 2px dashed var(--line);
  background: #fff8e9;
}

.comfort-orb {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: 82px;
  height: 86px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: #ffe5a8;
  color: var(--ink);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  padding: 6px 5px 5px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 5px 5px 0 var(--shadow);
  touch-action: none;
  user-select: none;
}

.comfort-orb:hover {
  transform: translate(1px, 1px);
  box-shadow: 4px 4px 0 var(--shadow);
}

.comfort-orb-icon {
  position: relative;
  content: "";
  display: block;
  width: 44px;
  height: 38px;
  border: 3px solid var(--line);
  background:
    radial-gradient(circle at 34% 42%, var(--ink) 0 3px, transparent 4px),
    radial-gradient(circle at 66% 42%, var(--ink) 0 3px, transparent 4px),
    radial-gradient(circle at 50% 68%, #fff2d6 0 11px, transparent 12px),
    #b9825d;
  box-shadow:
    -16px 8px 0 -7px #b9825d,
    16px 8px 0 -7px #b9825d,
    inset -5px -5px 0 rgba(91, 56, 43, 0.16);
}

.comfort-orb-icon::before,
.comfort-orb-icon::after {
  content: "";
  position: absolute;
  background: var(--line);
}

.comfort-orb-icon::before {
  left: 19px;
  top: 26px;
  width: 6px;
  height: 4px;
}

.comfort-orb-icon::after {
  left: 15px;
  top: -12px;
  width: 16px;
  height: 10px;
  border: 3px solid var(--line);
  border-bottom: 0;
  background: #8e5f49;
}

.comfort-orb-label {
  line-height: 1;
}

.game-invite {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 75;
  width: min(460px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: 6px 6px 0 var(--shadow);
}

.game-invite-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.game-invite-card {
  margin-bottom: 10px;
}

.game-invite-status {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 2px solid #9dbd95;
  border-radius: 14px;
  background: #eef8df;
  color: #536b4d;
  font-size: 13px;
  font-weight: 800;
}

.game-invite-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
}

@keyframes bearIdle {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(3px); }
}

@keyframes serveDish {
  0% { transform: translateY(0); }
  40% { transform: translateY(-26px); }
  100% { transform: translateY(0); }
}

@keyframes steam {
  0% { transform: translateY(8px); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: translateY(-12px); opacity: 0; }
}

@keyframes garlandGlow {
  0%, 100% { filter: brightness(0.95); }
  50% { filter: brightness(1.18); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes writeBob {
  0%, 100% { transform: scale(0.82) translateY(0); }
  50% { transform: scale(0.82) translateY(3px); }
}

@keyframes personFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 4px; }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .room-meta {
    width: 100%;
    justify-content: stretch;
  }

  .room-meta label {
    flex: 1;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 8px;
  }

  body {
    background-size: 18px 18px;
  }

  #app {
    width: 100%;
    padding: 8px 8px 18px;
  }

  .auth-screen {
    align-items: start;
    padding: 12px;
  }

  .auth-card {
    padding: 16px;
    box-shadow: 4px 4px 0 var(--shadow);
  }

  .auth-identity-grid {
    grid-template-columns: 1fr;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .scene-panel,
  .card,
  .topbar {
    box-shadow: 4px 4px 0 var(--shadow);
  }

  .topbar {
    margin-bottom: 10px;
    padding: 12px;
  }

  .room-meta {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .room-meta label {
    grid-column: 1 / -1;
  }

  .layout,
  .side-stack {
    gap: 10px;
  }

  .layout {
    display: block;
  }

  .side-stack {
    display: contents;
  }

  .round-card,
  .menu-card,
  .memory-card,
  .private-card {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 10px;
    bottom: 10px;
    z-index: 60;
    overflow: auto;
    display: none;
    box-shadow: 6px 6px 0 var(--shadow);
  }

  .menu-card {
    width: auto;
  }

  .round-card.open,
  .menu-card.open,
  .memory-card.open,
  .private-card.open {
    display: block;
  }

  .private-card {
    top: auto;
    min-height: min(78vh, 680px);
  }

  .setup-card {
    display: none !important;
  }

  .scene-panel,
  .card {
    padding: 12px;
  }

  .note-banner {
    align-items: flex-start;
    gap: 8px;
  }

  .note-close {
    width: 26px;
    height: 26px;
    font-size: 17px;
  }

  .panel-head {
    align-items: start;
  }

  .scene-tools {
    justify-content: flex-start;
    width: 100%;
    margin-top: 8px;
  }

  .more-tools-menu {
    left: auto;
    right: 0;
    max-width: calc(100vw - 28px);
    min-width: min(132px, calc(100vw - 28px));
  }

  .book-menu {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 10px 12px 18px;
  }

  .menu-catalog {
    grid-template-columns: 1fr;
  }

  .menu-page-head {
    align-items: center;
    flex-wrap: wrap;
  }

  .menu-page {
    padding: 10px;
  }

  .menu-item-card {
    padding: 10px 9px;
  }

  .menu-item-head {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .menu-item-actions,
  .secret-menu-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .secret-menu-head span {
    margin-right: 0;
  }

  .dining-scene {
    min-height: 226px;
  }

  .scene-garland {
    top: 10px;
    left: 28%;
    right: 10%;
    height: 32px;
  }

  .scene-garland span {
    width: 10px;
    height: 14px;
    margin-top: 14px;
  }

  .window-pixels {
    top: 18px;
    left: 14px;
    width: 76px;
    height: 56px;
  }

  .frame-left {
    left: 98px;
    top: 84px;
    transform: rotate(-2deg) scale(0.78);
    transform-origin: top left;
  }

  .frame-right,
  .scene-shelf {
    display: none;
  }

  .scene-plant {
    right: 8px;
    bottom: 6px;
    transform: scale(0.62);
    transform-origin: bottom right;
  }

  .scene-rug {
    bottom: 4px;
    width: 88%;
    height: 38px;
  }

  .pixel-person.left {
    left: -2px;
    transform: scale(0.82);
    transform-origin: bottom left;
  }

  .pixel-person.right {
    right: -2px;
    transform: scale(0.82);
    transform-origin: bottom right;
  }

  .pixel-bear {
    transform: translateX(-50%) scale(0.78);
    transform-origin: bottom center;
  }

  .table {
    width: 90%;
    height: 78px;
  }

  .plate-a {
    left: 44px;
  }

  .plate-b {
    right: 44px;
  }

  .message-log {
    min-height: 220px;
    max-height: 48vh;
  }

  .private-log {
    max-height: 34vh;
  }

  .role-grid {
    grid-template-columns: 1fr;
  }

  .history-head {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
  }

  .composer-actions {
    justify-content: stretch;
  }

  .composer-actions button {
    flex: 1;
  }

  .composer-row,
  .composer-actions.wrap {
    display: grid;
    grid-template-columns: 1fr;
  }

  .composer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .comfort-orb {
    right: 12px;
    bottom: 12px;
  }

  .game-invite {
    left: 8px;
    right: 8px;
    bottom: 10px;
    width: auto;
    transform: none;
  }

  .game-invite-actions {
    grid-template-columns: 1fr;
  }
}
