/* Shared responsive workspaces. Breakpoints change arrangement, not available actions. */
button,
input,
select,
textarea {
  font-size: 14px;
}
input,
select,
textarea {
  min-width: 0;
}
button,
a,
summary {
  touch-action: manipulation;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.btn.small,
.text-btn,
.small-note,
.controller-status,
.control-guide,
.hint-text,
.controller-settings,
.controller-settings select,
.card-description,
.guide-card p {
  font-size: 13px;
}
.btn.small,
.icon-button {
  min-height: 40px;
}
.card-bottom,
.difficulty,
.game-underbar,
.view-label,
kbd,
.section-kicker,
.stats-row label,
.game-title .section-kicker {
  font-size: 11px;
}
.card-description {
  height: auto;
  min-height: 3em;
}
.card-bottom {
  flex-wrap: wrap;
  gap: 8px;
}
.level-info h3 {
  font-size: 17px;
}
.site-header {
  height: 72px;
  padding-inline: 24px;
}
.site-header nav {
  gap: 24px;
}
.site-header nav a {
  font-size: 14px;
}
main {
  padding-inline: 24px;
}
main:has(.game-layout),
main:has(.editor-layout) {
  max-width: none;
}
.page-heading {
  padding: 20px 0 16px;
  gap: 12px;
}
.page-heading h1 {
  font-size: 28px;
}
.site-footer {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
dialog {
  max-width: min(94vw, 760px);
  max-height: 90dvh;
  overflow: auto;
}
dialog:has(.guide-dialog),
dialog:has(.revision-comparison) {
  width: min(1100px, 94vw);
  max-width: 1100px;
}
.dialog-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 3;
}
.guide-dialog .page-heading {
  padding-top: 0;
}
.guide-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block: 12px 20px;
}
.guide-search {
  display: block;
  max-width: 560px;
  margin-block: 12px;
}
.guide-search input {
  width: 100%;
}
.guide-card {
  scroll-margin-block: 20px;
}
.guide-grid {
  margin-block: 16px 28px;
}
.guide-details {
  margin-block: 18px;
}
.guide-details > summary {
  padding: 12px;
  font-size: 17px;
  cursor: pointer;
}
.guide-rules,
.guide-dialog .panel {
  margin-block: 18px;
}

.game-play-area,
.game-play-area *,
.logic-preview canvas,
.logic-preview .touch-controls,
.logic-preview .shared-controls {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.shared-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 6px;
  flex-basis: 100%;
  max-width: 520px;
}
.shared-controls .small-note {
  grid-column: 1 / -1;
  margin: 0;
}
.shared-controls button {
  white-space: normal;
  min-height: 44px;
  padding: 6px 10px;
}
.shared-controls button[aria-pressed='true'] {
  border-color: var(--accent);
}
.game-sidebar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: 12px;
  align-items: start;
}
.game-sidebar .stat-panel {
  padding: 18px;
  min-width: 0;
}
.game-sidebar .stat-panel:last-child {
  grid-column: auto;
}
.game-layout:has(.overlay:not([hidden])) .player-actions {
  visibility: hidden;
}
.overlay {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(540px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  height: auto;
  overflow: auto;
  justify-content: flex-start;
  gap: 12px;
  padding: 24px;
  box-shadow: 0 0 0 100vmax #07100bcc;
  z-index: 8;
}
.overlay h2 {
  font-size: 28px;
}
.overlay p {
  font-size: 15px;
  flex-shrink: 0;
}
.overlay > * {
  flex-shrink: 0;
}
.overlay .win-symbol {
  font-size: 32px;
}
.touch-controls {
  flex: 1 1 100%;
  gap: 16px;
  margin: 0;
  align-items: center;
}
.touch-joystick {
  position: relative;
  padding: 0;
  width: var(--joystick-size, 104px);
  height: var(--joystick-size, 104px);
  flex: 0 0 var(--joystick-size, 104px);
  border: 2px solid #6a8062;
  border-radius: 50%;
  background: radial-gradient(circle, #425740 0 8%, #243529 9% 47%, #31432f 48%);
  touch-action: none;
  cursor: grab;
}
.joystick-knob {
  position: absolute;
  inset: 0;
  transform: translate(var(--stick-x, 0%), var(--stick-y, 0%));
  pointer-events: none;
}
.joystick-knob::after {
  content: '';
  position: absolute;
  inset: 34%;
  border: 2px solid #bfcca7;
  border-radius: 50%;
  background: #90a97bcc;
}
.joystick-label {
  position: absolute;
  left: 0;
  bottom: 9%;
  width: 100%;
  text-align: center;
  font-size: 11px;
  color: #c3cfb5;
  pointer-events: none;
}
.touch-controls[data-joystick-side='right'] {
  flex-direction: row-reverse;
}
.touch-controls button {
  min-width: 44px;
  min-height: 48px;
  touch-action: none;
  user-select: none;
}
.touch-brake {
  min-width: 72px !important;
  height: 64px;
  border-radius: 50%;
}
.touch-instructions {
  display: none;
}
.device-bindings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.device-bindings label {
  margin: 0;
}
.device-test {
  min-height: 1.5em;
}
@media (any-pointer: coarse) {
  .touch-controls {
    display: flex;
  }
  .touch-instructions {
    display: block;
  }
  .mouse-instructions {
    display: none;
  }
}

/* Editor panels have separate scrolling; the board keeps its own zoom/pan. */
.editor-actions {
  margin: 0;
  padding-block: 6px;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg, #171c1a);
}
.editor-actions .btn {
  min-height: 38px;
  font-size: 13px;
  padding: 6px 10px;
}
.editor-views {
  margin: 6px 0 10px;
  gap: 6px;
}
.editor-views .btn {
  min-height: 38px;
  padding: 6px 12px;
}
.editor-layout {
  grid-template-columns: 220px minmax(0, 1fr) minmax(240px, 300px);
  height: max(400px, calc(100dvh - 235px));
  gap: 12px;
  padding: 0;
  margin-bottom: 24px;
}
.palette {
  display: block;
  grid-row: auto;
  overflow: auto;
  height: 100%;
  padding: 10px;
}
.palette h2,
.palette h2:not(:first-child) {
  font-size: 12px;
  margin: 14px 0 8px;
}
.palette h2:first-child {
  margin-top: 0;
}
.palette-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.tool {
  padding: 6px 2px;
  min-height: 65px;
}
.tool span,
.selection-tools .tool span {
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.selection-tools {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.selection-tools [data-select-layer] {
  position: relative;
}
.selection-tools [data-select-layer][aria-pressed='true']::after {
  content: '✓';
  position: absolute;
  top: 3px;
  right: 5px;
  color: var(--accent);
  font-size: 13px;
}
.selection-tools .tool svg {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.tool canvas {
  flex-shrink: 0;
}
.editor-board-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 8px;
}
.room-toolbar {
  margin: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.room-toolbar label {
  font-size: 12px;
}
.room-toolbar select {
  flex: 1;
  min-width: 100px;
}
.board-view-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}
.board-view-tools label {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}
.board-view-tools select {
  width: 95px;
}
.board-view-tools [aria-pressed='true'],
.editor-panel-tabs [aria-pressed='true'] {
  background: var(--accent);
  color: #171c1a;
}
.editor-stage {
  flex: 1;
  min-height: 160px;
  width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  position: relative;
  padding: 8px;
}
.editor-stage canvas {
  max-width: none;
  margin: auto;
}
.editor-stage.panning canvas {
  cursor: grab;
}
.editor-sidebar {
  display: block;
  grid-column: auto;
  height: 100%;
  overflow: auto;
  min-width: 0;
  padding: 0 8px 8px;
}
.editor-sidebar > * {
  width: 100%;
}
.editor-sidebar .inspector {
  margin: 0 0 14px;
  padding: 12px;
}
.editor-sidebar label {
  font-size: 12px;
}
.editor-sidebar input,
.editor-sidebar select,
.editor-sidebar textarea {
  font-size: 16px;
}
.level-settings > summary {
  font-size: 16px;
  cursor: pointer;
  padding: 10px 0;
}
.editor-instructions {
  font-size: 13px;
}
.editor-instructions summary {
  cursor: pointer;
}
.editor-note {
  margin: 8px 0;
  font-size: 13px;
}
.editor-panel-tabs {
  display: none;
}

/* Logic stays a diagram and preview workspace, not several screens of toolbars. */
#logic-editor > .logic-toolbar {
  gap: 8px;
}
#logic-editor > .logic-toolbar h2 {
  font-size: 20px;
}
#logic-editor > .logic-toolbar p {
  display: none;
}
.logic-add {
  margin-block: 8px;
  padding: 8px;
  gap: 8px;
}
.logic-add label {
  font-size: 12px;
}
.logic-add select {
  min-height: 36px;
}
.logic-actions {
  gap: 6px;
}
.logic-actions .btn {
  min-height: 36px;
  padding: 6px 10px;
}
#logic-status,
#logic-conversion-status {
  margin: 4px 0;
  font-size: 12px;
}
.logic-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 32%);
  gap: 12px;
  align-items: stretch;
}
.logic-workbench .logic-scroll {
  height: max(350px, calc(100dvh - 415px));
  max-height: none;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}
.logic-workbench .logic-preview {
  min-width: 0;
  max-height: max(350px, calc(100dvh - 415px));
  overflow: auto;
  margin: 0;
  padding: 10px;
}
.logic-preview .logic-toolbar {
  gap: 6px;
}
.logic-preview .logic-toolbar h3 {
  width: 100%;
  font-size: 17px;
}
.logic-preview .small-note {
  font-size: 12px;
  line-height: 1.4;
  margin: 8px 0;
}
#logic-preview-board {
  width: 100%;
  touch-action: none;
}
.logic-preview .touch-controls {
  flex-wrap: wrap;
  gap: 6px;
}
.logic-preview.enlarged {
  position: fixed;
  inset: 5dvh 5vw;
  max-height: 90dvh;
  width: auto;
  z-index: 6;
  box-shadow: 0 0 0 100vmax #07100bcc;
  resize: none;
}
.logic-preview.enlarged #logic-preview-board {
  width: auto;
  max-width: 100%;
  max-height: 60dvh;
  margin: auto;
}
.logic-view-tabs {
  display: none;
}
.logic-node .logic-settings {
  font-size: 13px;
}
.logic-node.compact .logic-settings {
  display: none;
}

.pack-library {
  margin-block: 18px;
}
.pack-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pack-picker label {
  flex: 1;
  min-width: 180px;
  font-size: 13px;
}
.pack-picker select {
  width: 100%;
}
.pack-browser {
  margin-top: 12px;
}
.pack-browser > summary {
  cursor: pointer;
  padding: 8px 0;
}
.pack-grid {
  margin-block: 10px;
}
.pack-actions {
  gap: 8px;
}
.library-search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-block: 12px;
}
.library-search label {
  margin: 0;
  font-size: 13px;
}
.library-search input[type='search'] {
  min-width: 200px;
  flex: 1;
}
.library-search input[type='number'] {
  width: 84px;
}
.together-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-block: 12px;
}
.lan-panel {
  margin-block: 14px;
}
.ordering-controls {
  flex-wrap: wrap;
  justify-content: end;
}
.ordering-position {
  width: 65px;
  font-size: 16px;
}
.revision-comparison {
  overflow: auto;
}
.change-summary {
  margin-block: 12px;
}
.change-summary li {
  margin-block: 8px;
  overflow-wrap: anywhere;
}
.change-summary pre {
  white-space: pre-wrap;
  font-size: 13px;
  max-height: 220px;
}
.revision-source {
  max-height: none;
  overflow: auto;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .editor-layout {
    grid-template-columns: 175px minmax(0, 1fr) 240px;
  }
  .palette-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .site-header nav {
    gap: 14px;
  }
}
@media (max-width: 760px) {
  .site-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px 12px;
    height: auto;
    padding: 8px 12px 0;
  }
  .site-header .brand {
    font-size: 22px;
  }
  .site-header nav {
    grid-row: 2;
    grid-column: 1 / -1;
    width: 100%;
    margin: 0;
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }
  .site-header nav a {
    font-size: 13px;
    padding: 12px 0;
  }
  .site-header nav a[data-nav='guide'],
  .site-header .icon-button {
    display: inline-flex;
  }
  .site-header #account-button {
    font-size: 12px;
  }
  main {
    padding-inline: 12px;
  }
  .page-heading {
    flex-direction: row;
    align-items: center;
    padding-block: 14px 10px;
  }
  .page-heading h1 {
    font-size: 24px;
  }
  .page-heading .btn {
    padding: 8px 10px;
    font-size: 13px;
  }
  .btn,
  .btn.small,
  .text-btn,
  .chip,
  .segmented button {
    min-height: 44px;
  }
  .input,
  select,
  textarea {
    font-size: 16px;
  }
  .level-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  }
  .level-info h3 {
    font-size: 18px;
  }
  .card-description {
    font-size: 14px;
  }
  .card-bottom {
    font-size: 12px;
  }
  .section-top {
    flex-wrap: wrap;
    align-items: center;
  }
  .library-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .pack-actions {
    flex-wrap: wrap;
  }
  .game-sidebar {
    grid-template-columns: 1fr;
  }
  .touch-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .touch-controls button {
    min-width: 42px;
  }
  .overlay {
    padding: 20px;
  }
  .overlay h2 {
    font-size: 24px;
  }
  .editor-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-block: 6px;
  }
  .editor-actions .btn {
    flex-shrink: 0;
  }
  .editor-views {
    flex-wrap: wrap;
  }
  .editor-views .btn {
    font-size: 13px;
  }
  #disconnected-count {
    display: none;
  }
  .editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: max(350px, calc(100dvh - 290px));
    gap: 8px;
  }
  .editor-panel-tabs {
    display: flex;
    gap: 8px;
  }
  .editor-panel-tabs .btn {
    flex: 1;
  }
  .editor-layout .palette,
  .editor-layout .editor-sidebar,
  .editor-layout .editor-board-panel {
    display: none;
    grid-row: 2;
    grid-column: 1;
    height: 100%;
  }
  .editor-layout[data-panel='tools'] .palette,
  .editor-layout[data-panel='properties'] .editor-sidebar {
    display: block;
  }
  .editor-layout[data-panel='board'] .editor-board-panel {
    display: flex;
  }
  .palette-grid {
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
  }
  .palette h2,
  .palette-grid {
    grid-row: auto;
  }
  .tool span {
    font-size: 12px;
  }
  .editor-sidebar {
    padding: 4px;
    resize: none;
  }
  .editor-sidebar > * {
    width: 100%;
  }
  .room-toolbar {
    gap: 4px;
  }
  .room-toolbar > label {
    display: none;
  }
  .board-view-tools {
    gap: 4px;
  }
  .board-view-tools .btn,
  .board-view-tools select {
    min-height: 38px;
  }
  .editor-instructions {
    max-height: 70px;
    overflow: auto;
  }
  .logic-workbench {
    grid-template-columns: minmax(0, 1fr);
  }
  .logic-workbench .logic-scroll {
    height: max(350px, calc(100dvh - 400px));
  }
  .logic-workbench .logic-preview {
    max-height: none;
    resize: none;
  }
  .logic-view-tabs {
    display: flex;
    gap: 8px;
    margin-block: 8px;
  }
  #logic-editor[data-panel='diagram'] .logic-preview,
  #logic-editor[data-panel='preview'] .logic-scroll {
    display: none;
  }
  .logic-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .logic-add label {
    min-width: 0;
  }
  .logic-add select {
    min-width: 0;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .guide-card {
    flex-direction: row;
  }
  .guide-card p {
    font-size: 14px;
  }
  dialog {
    padding: 16px;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .site-header {
    height: auto;
    padding-block: 4px;
  }
  .site-header .brand {
    font-size: 20px;
  }
}

.pack-browser .pack-card {
  padding: 10px 14px;
}
.pack-browser .pack-card h3 {
  font-size: 16px;
  margin: 0 0 6px;
}
.pack-browser .pack-icon,
.pack-browser .pack-card p {
  display: none;
}
.pack-browser .pack-counts {
  margin-top: 8px;
  font-size: 12px;
}
.pack-browser .section-top {
  margin-bottom: 12px;
}
.pack-browser .section-top h2 {
  font-size: 20px;
}
.pack-browser .pack-actions {
  flex-wrap: wrap;
}

.sync-list:has(.revision-comparison) {
  max-height: none;
  overflow: visible;
}
.comparison.revision-comparison {
  overflow: visible;
}
.revision-comparison pre {
  max-height: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.change-summary del {
  color: #f4b8a9;
  text-decoration: none;
}
.change-summary ins {
  color: #c5e4b2;
  text-decoration: none;
}
.change-summary del::before {
  content: '− ';
}
.change-summary ins::before {
  content: '+ ';
}

.editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  padding-block: 8px;
}
.editor-header .page-heading {
  padding: 0;
  gap: 16px;
  flex: 0 0 auto;
}
.editor-header h1 {
  letter-spacing: -0.02em;
  font-size: 22px;
}
.editor-header .editor-actions {
  position: static;
  flex: 1;
}
.logic-add-menu {
  margin-block: 8px;
}
.logic-add-menu > summary {
  cursor: pointer;
  font-size: 14px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
#logic-editor[data-selection='false'] #logic-conversion-status {
  visibility: hidden;
}
#logic-conversion-status {
  min-height: 1.5em;
}
.logic-preview > details {
  margin-block: 8px;
  font-size: 13px;
}
.logic-workbench .logic-scroll,
.logic-workbench .logic-preview {
  height: max(320px, calc(100dvh - 355px));
  max-height: none;
}
.logic-workbench .logic-preview.enlarged {
  height: auto;
}
@media (max-width: 760px) {
  .editor-header {
    display: block;
  }
  .editor-header .page-heading {
    padding-block: 6px;
  }
  .editor-header .editor-actions {
    position: sticky;
    top: 0;
  }
  .logic-workbench .logic-preview {
    height: auto;
  }
}

.pack-picker > label {
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
}
.pack-picker > select {
  flex: 1;
  min-width: 180px;
}
.workshop-pack-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin-block: 8px 16px;
}
.workshop-pack-bar .pack-picker {
  flex: 1 1 320px;
  min-width: 0;
}
.workshop-pack-bar .pack-actions {
  margin: 0;
}
#game-settings-content .game-sidebar {
  display: block;
}
#game-settings-content .stat-panel {
  margin-block: 12px;
}
@media (min-width: 761px) {
  .touch-controls {
    display: none;
  }
}
@media (any-pointer: coarse) {
  .touch-controls {
    display: flex;
  }
}

.logic-tools > summary {
  cursor: pointer;
  padding: 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
@media (min-width: 761px) {
  .logic-tools > summary {
    display: none;
  }
}
@media (max-width: 760px) {
  #logic-editor[data-panel='preview'] > .logic-tools,
  #logic-editor[data-panel='preview'] > .logic-actions,
  #logic-editor[data-panel='preview'] > #logic-conversion-status {
    display: none;
  }
  .logic-workbench .logic-scroll {
    height: max(350px, calc(100dvh - 430px));
  }
  .logic-view-tabs {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #171c1a;
    padding-block: 4px;
  }
  .logic-actions {
    margin-block: 6px;
  }
}

[data-pad-editing='true'] {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.editor-sidebar .inspector p {
  font-size: 13px;
  line-height: 1.5;
}
.logic-view-tabs [aria-pressed='true'] {
  background: var(--accent);
  color: #171c1a;
}
/* Inventories stay outside the board and keep touch targets usable in both
   player rows. Slots scroll horizontally instead of shrinking their artwork. */
.player-items {
  min-width: 0;
  overflow: visible;
  display: grid;
  gap: 0.5rem;
  width: 100%;
}
.player-items[hidden] {
  display: none;
}
.inventory-player {
  min-width: 0;
  height: 136px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line, #485448);
  border-radius: 10px;
  background: #18211ddd;
}
.inventory-heading {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
  font-size: 0.8rem;
}
.inventory-lives {
  color: #c3cfb5;
  margin-right: auto;
  white-space: nowrap;
}
.inventory-actions {
  display: flex;
  gap: 0.2rem;
}
.inventory-action {
  min-height: 36px;
  min-width: 36px;
  border: 1px solid #556352;
  border-radius: 7px;
  padding: 0.2rem 0.55rem;
  color: #edf0de;
  background: #2d3b32;
  cursor: pointer;
}
.inventory-strip {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.3rem 0;
  min-height: 58px;
  flex: 1;
  scrollbar-width: thin;
}
.inventory-slot {
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 44px;
  border-radius: 8px;
  border: 1px solid #596950;
  background: #334538;
  cursor: pointer;
}
.inventory-slot canvas {
  width: 42px;
  height: 42px;
  pointer-events: none;
}
.inventory-slot.selected {
  border: 2px solid #f0c388;
  background: #596043;
}
.inventory-slot:focus-visible,
.inventory-action:focus-visible {
  outline: 2px solid #f5e6bd;
  outline-offset: 2px;
}
.inventory-empty {
  font-size: 0.8rem;
  color: #bac8af;
  align-self: center;
}
.inventory-selection {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.75rem;
  color: #c8d3bb;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}
.inventory-action:disabled,
.inventory-slot:disabled {
  cursor: default;
  opacity: 0.6;
}
.inventory-settings {
  margin: 1rem 0;
}
.inventory-settings summary {
  cursor: pointer;
  padding: 0.5rem 0;
}
.inventory-settings fieldset {
  min-width: 0;
  margin-top: 0.75rem;
  border: 1px solid #50614c;
  border-radius: 8px;
}
.initial-items {
  padding-left: 1.2rem;
}
.initial-items li {
  margin-bottom: 0.75rem;
}
.initial-item-actions,
.initial-item-add {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
}
.initial-item-add select {
  min-width: 0;
  flex: 1;
}
.document-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.inventory-note {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.inventory-note-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.8rem;
}
.inventory-note .document-text {
  margin: 0.35rem 0 0;
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  font-size: 0.85rem;
  line-height: 1.5;
  -webkit-user-select: text;
  user-select: text;
}
.inventory-note .document-text:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (pointer: coarse) {
  .inventory-action {
    min-height: 44px;
    min-width: 44px;
  }
}
@media (min-width: 700px) {
  .player-items:has(.inventory-player:nth-of-type(2)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.inventory-tabs {
  display: none;
}
@media (max-width: 699px) {
  .game-layout #mouse-status {
    display: none;
  }
  .inventory-player {
    height: 128px;
  }
  .player-items:has(.inventory-player:nth-of-type(2)) .inventory-tabs {
    display: flex;
    gap: 4px;
  }
  .inventory-tabs button {
    flex: 1;
    min-width: 0;
    height: 44px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    color: var(--text);
    background: #26372c;
    border: 1px solid #52634e;
    border-radius: 6px;
  }
  .inventory-tabs button[aria-pressed='true'] {
    border-color: var(--accent);
  }
  .inventory-player:not(.inventory-current) {
    display: none;
  }
  .inventory-action[data-inventory-action='previous'],
  .inventory-action[data-inventory-action='next'] {
    display: none;
  }
  .inventory-tabs + .inventory-player .inventory-heading strong {
    display: none;
  }
}
