.tavern-mode {
  position: absolute; z-index: 3; top: clamp(72px, 7.2vw, 105px); left: 26px;
  display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: #271733ed; border: 1px solid #af8bc4a6;
}
.tavern-mode button {
  padding: 6px 10px; min-height: 34px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--cream); font-size: 13px; font-weight: 800;
}
.tavern-mode button[aria-pressed="true"] { color: #ffe3a4; background: #59406a; border-color: #c096cf; }
.party-tavern { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.party-tavern button, .party-tavern input, .party-tavern select, .party-panel { pointer-events: auto; }
.party-panel {
  min-width: 0; width: min(100%, 315px); padding: 15px;
  border: 1px solid #bf91bc; border-radius: 16px; background: #342246f7;
  box-shadow: 0 6px #22152f, 0 15px 30px #21122ba6;
}
.party-entry { position: absolute; right: 4%; bottom: 12%; display: grid; gap: 8px; }
.party-panel h3 { margin: 0; color: #fff1d7; font: 800 23px/1.05 var(--display); letter-spacing: -.045em; }
.party-panel p { font-size: 12px; }
.party-muted { color: #e3cbe8; font-size: 12px; }
.party-panel label { color: #f1e0f7; font-size: 13px; font-weight: 750; }
.party-panel input, .party-panel select {
  width: 100%; min-width: 0; height: 39px; padding: 5px 8px; border-radius: 8px;
  border: 1px solid #9270a1; background: #241832; color: #ffe9be; font: 700 14px var(--body);
}
.party-panel input:focus-visible, .party-panel select:focus-visible { outline: 2px solid #ead0ff; outline-offset: 2px; }
#party-join-code { text-transform: uppercase; }
.party-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 9px;
  border: 1px solid #9b76aa; border-radius: 9px; background: #503663; color: #fae5ff;
  font: 800 13px/1.13 var(--body); box-shadow: inset 0 -2px #3c284b;
  transition: transform 140ms var(--ease-out);
}
.party-button.primary { color: #362340; border-color: #ffe7a9; background: #ffd67e; box-shadow: inset 0 -3px #cc9354; }
.party-button:disabled { opacity: .65; }
.party-button:active:not(:disabled) { transform: scale(.97); }
.party-join { display: grid; gap: 4px; margin-top: 4px; padding-top: 10px; border-top: 1px solid #715080; }
.party-inline { display: flex; align-items: end; gap: 6px; min-width: 0; }
.party-inline > label, .party-inline > input { flex: 1; min-width: 0; }
.party-inline > label { display: grid; gap: 3px; }
.party-inline > button { flex: none; white-space: nowrap; }
.party-room {
  position: absolute; bottom: 9%; right: 4%; left: 25%;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 315px);
  align-items: end; gap: clamp(9px, 2vw, 28px);
}
.party-playfield { min-width: 0; position: relative; }
.party-seats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; gap: 5px; }
.party-seat {
  min-width: 0; position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 5px 2px 7px;
  min-height: 107px; border-radius: 10px; border: 1px solid #bb86b791; background: #3a254be0;
  font-size: 11px; text-align: center; color: #f7dff8; box-shadow: 0 3px #2918339f;
}
.party-seat strong { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff1d8; }
.party-seat small { font-size: 10px; color: #edd2ee; }
.party-seat .party-avatar {
  display: block; width: 48px; height: 44px; background: url("assets/werkstatt-objekte.png") 100% 0 / 200% 200% no-repeat;
  filter: drop-shadow(0 3px 2px #1c1029);
}
.party-seat:nth-child(2) .party-avatar { filter: hue-rotate(34deg) drop-shadow(0 3px 2px #1c1029); }
.party-seat:nth-child(3) .party-avatar { filter: hue-rotate(-26deg) drop-shadow(0 3px 2px #1c1029); }
.party-seat:nth-child(4) .party-avatar { filter: hue-rotate(65deg) drop-shadow(0 3px 2px #1c1029); }
.party-seat.empty { border-style: dashed; background: #39254d9a; box-shadow: none; }
.party-seat.empty .party-avatar { opacity: .3; filter: brightness(.5); }
.party-seat.empty strong { color: #e7cde5; }
.party-seat.ready { border-color: #b8db9c; }
.party-seat-stake { color: #ffe2a4; font-weight: 800; overflow-wrap: anywhere; }
.party-seat.turn, .party-seat.winner { border-color: #ffd98b; box-shadow: 0 0 0 2px #f4ba7057, 0 3px #2918339f; }
.party-seat.winner strong { color: #ffdc84; }
.party-table-center {
  min-height: 158px; display: grid; justify-items: center; align-content: center; gap: 7px; padding: 12px 2px 0;
  text-align: center; text-shadow: 0 2px #2c1839, 0 4px 10px #26132e;
}
.party-pot { color: #ffe2a4; background: #382447da; border: 1px solid #ab7b9d; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 800; }
.party-headline { color: #ffe5a7; font: 800 clamp(21px, 3vw, 40px)/1.02 var(--display); letter-spacing: -.045em; }
.party-headline:empty, .party-result:empty { display: none; }
.party-result { color: #fae4f0; font-size: 13px; font-weight: 750; }
.party-roll { display: grid; justify-items: center; gap: 7px; padding: 2px 9px; border: 0; background: none; }
.party-d100 {
  min-width: 77px; padding: 9px; border: 2px solid #ffedc0; border-radius: 13px;
  background: #ffd38a; box-shadow: 3px 5px #a26b50, 6px 8px 13px #301638;
  color: #3d2647; font: 800 22px var(--display); transform: rotate(-5deg);
}
.party-dice { display: flex; align-items: center; gap: 8px; }
.party-dice .die { width: clamp(32px, 4vw, 45px); padding: 5px; border-radius: 9px; }
.party-dice .die:nth-child(2) { background: #ca99f1; border-color: #edd4ff; transform: rotate(-6deg); }
.party-dice .die:nth-child(3) { transform: rotate(5deg); }
.party-controls { justify-self: end; }
.party-room-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding-bottom: 8px; margin-bottom: 9px; border-bottom: 1px solid #755783;
}
.party-room-heading span { display: block; }
.party-room-heading strong { display: block; color: #ffdfa0; font-size: 17px; font-weight: 800; letter-spacing: .08em; }
#party-rules { margin-top: 4px; }
.party-settings, .party-bid-form, .party-lobby-actions { display: grid; gap: 7px; margin-top: 10px; }
.party-contribution {
  display: grid; gap: 7px; min-width: 0; margin: 0; padding: 7px 9px 9px;
  border: 1px solid #9b716f; border-radius: 9px; background: #2a1b2d;
}
.party-contribution legend { padding: 0 5px; color: #ffe2a4; font-size: 12px; font-weight: 800; }
.party-contribution:disabled input, .party-contribution:disabled select { opacity: .77; }
.party-status { margin-top: 8px; color: #fae4fb; font-weight: 750; }
.party-status:empty, .party-room-actions:empty { display: none; }
.party-timer { color: #ffdd9b; font-variant-numeric: tabular-nums; }
.party-room-actions { flex-wrap: wrap; margin-top: 5px; }
.party-message {
  position: absolute; bottom: 1%; right: 4%; max-width: 92%; width: max-content;
  padding: 6px 9px; border: 1px solid #c994b8; border-radius: 8px; background: #39244ded;
  color: #ffe4a8; font-size: 12px; font-weight: 750;
}
.party-message.error { color: #ffc3cb; }
@media (hover: hover) and (pointer: fine) {
  .party-button:hover:not(:disabled), .tavern-mode button:hover { background: #6b4b7c; }
  .party-button.primary:hover:not(:disabled) { background: #ffe3a0; }
}
@media (max-width: 960px) {
  .party-room { left: 14%; }
}
@media (max-width: 740px) {
  .party-room { left: 5%; right: 5%; bottom: 7%; grid-template-columns: minmax(0, 1fr) minmax(200px, 245px); gap: 8px; }
  .party-panel { padding: 10px; }
  .party-seat { min-height: 90px; }
  .party-seat .party-avatar { width: 36px; height: 34px; }
}
@media (max-width: 620px) {
  .tavern-world:has(.party-tavern:not([hidden])) { min-height: 630px; }
  .tavern-mode { top: 110px; left: 12px; }
  .party-room { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .party-controls { justify-self: center; }
  .party-table-center { min-height: 105px; gap: 4px; padding-top: 4px; }
  .party-entry { right: 50%; translate: 50% 0; width: min(90%, 315px); }
  .party-message { right: 50%; translate: 50% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .party-button { transition: none; }
  .party-button:active:not(:disabled) { transform: none; }
}
