.app-shell {
  --workspace-gap: clamp(14px, 1.7vw, 24px);
  --frame-padding: clamp(14px, 2vw, 24px);
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.32), transparent 26%),
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(244, 237, 226, 0.98));
  overflow: hidden;
}

.session-strip {
  display: grid;
  grid-template-columns: minmax(250px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 60px;
  padding: 12px clamp(16px, 2vw, 24px);
  border-bottom: 1px solid rgba(83, 66, 45, 0.12);
  background: rgba(255, 252, 246, 0.78);
  backdrop-filter: blur(10px);
}

.session-strip-mobile {
  display: none;
}

.session-strip__brand,
.brand-copy__title-row,
.session-strip__center,
.session-strip__meta,
.session-strip__pills {
  display: flex;
  align-items: center;
}

.session-strip__brand,
.brand-copy__title-row {
  gap: 8px;
}

.session-strip__center {
  justify-content: center;
  gap: 14px;
}

.session-strip__meta {
  justify-content: flex-end;
  gap: 12px;
}

.session-strip__pills {
  gap: 10px;
}

.brand-badge {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--green);
  color: #fffdf7;
  font-size: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.brand-copy h1 {
  font-size: 22px;
  line-height: 1;
}

.room-code-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(246, 239, 228, 0.95);
}

.room-code__label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.room-code {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.session-strip__summary {
  display: none;
}

.session-strip__versus {
  color: var(--text-soft);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.seat-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.96);
}

.seat-card--black {
  background: var(--surface-dark);
  border-color: rgba(67, 55, 47, 0.92);
  color: #fff7ea;
}

.seat-card__icon {
  width: 10px;
  height: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.seat-card__text {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.seat-card strong {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-card__meta {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(197, 163, 91, 0.18);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.seat-card--black .seat-card__meta {
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 247, 234, 0.88);
}

.seat-card.is-open {
  opacity: 0.78;
}

.seat-card.is-active {
  border-color: rgba(92, 138, 103, 0.55);
}

.seat-card.is-you {
  box-shadow: inset 0 0 0 1px rgba(197, 163, 91, 0.45);
}

.session-pill,
.turn-pill,
.history-position,
.canvas-mode-pill,
.mobile-seat-pill,
.mobile-room-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.94);
  font-size: 11px;
  font-weight: 700;
}

.history-position {
  min-height: 28px;
  padding-inline: 12px;
  font-size: 10px;
}

.session-pill--muted,
.history-position {
  color: var(--text-soft);
}

.session-pill--warn {
  color: #a06f31;
  background: rgba(197, 163, 91, 0.15);
}

.session-pill--live::before,
.mobile-seat-pill.is-active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.session-pill--live {
  color: var(--green);
}

#seat-pill {
  display: none;
}

.room-copy-button {
  min-width: 112px;
  min-height: 42px;
  border-radius: 12px;
}

.room-copy-button::before {
  content: "->";
  font-size: 12px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, clamp(360px, 37vw, 560px)) minmax(0, 1fr);
  gap: var(--workspace-gap);
  min-height: 0;
  overflow: hidden;
  padding: var(--frame-padding);
  align-items: stretch;
}

.workspace-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--workspace-gap);
  min-width: 0;
  min-height: 0;
  align-items: stretch;
}

.workspace-main > .chess-panel,
.workspace > .whiteboard-panel {
  min-height: 0;
}

.history-panel[hidden] {
  display: none !important;
}

.panel {
  min-width: 0;
}

.history-panel {
  min-height: 0;
  max-height: clamp(140px, 24dvh, 240px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(255, 253, 249, 0.98);
  border: 1px solid rgba(102, 82, 56, 0.18);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
  overflow: hidden;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(102, 82, 56, 0.12);
}

.history-head__copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-head h2 {
  font-size: 17px;
  line-height: 1.05;
}

.panel-head h2 {
  font-size: 17px;
  line-height: 1.1;
}

.history-count {
  font-size: 11px;
  color: var(--text-faint);
}

.history-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.history-toggle {
  display: inline-flex;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
}

.history-body {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
}

.history-panel.is-collapsed {
  background: rgba(251, 247, 239, 0.92);
}

.history-panel.is-collapsed .history-head {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 0;
}

.history-panel.is-collapsed .history-head__copy {
  gap: 6px;
}

.history-panel.is-collapsed .history-head h2 {
  font-size: 15px;
}

.history-panel.is-collapsed .history-head__actions {
  flex-direction: column;
  align-items: stretch;
}

.history-panel.is-collapsed .history-position {
  display: none;
}

.history-panel.is-collapsed .history-toggle {
  width: 100%;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 2px;
}

.panel-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seat-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: block;
}

.seat-dot--white {
  background: #bf9550;
}

.seat-dot--black {
  background: #cf8e63;
}

.mobile-dock {
  display: none;
}
