:root {
  --wood-deep: #120c08;
  --wood-dark: #1e140e;
  --wood-mid: #2d1f14;
  --wood-light: #3d2b1c;
  --wood-grain: #4a3525;
  --candle: #f0b84d;
  --candle-glow: #e8a030;
  --candle-soft: rgba(240, 184, 77, 0.18);
  --parchment: #d9c9a8;
  --parchment-dark: #c4b08a;
  --ink: #1a1008;
  --ink-muted: #5c4a38;
  --burgundy: #6b2d2d;
  --gold: #b8860b;
  --cream: #f5ead6;
  --shadow: rgba(8, 4, 2, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'VT323', monospace;
  background: var(--wood-deep);
  color: var(--cream);
  min-height: 100vh;
  overflow: hidden;
}

.candle-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 15% 10%, var(--candle-soft) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 15%, rgba(240, 184, 77, 0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 90%, rgba(240, 184, 77, 0.08) 0%, transparent 50%);
  animation: candleFlicker 4s ease-in-out infinite;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(8, 4, 2, 0.65) 100%);
}

@keyframes candleFlicker {
  0%, 100% { opacity: 1; }
  40% { opacity: 0.92; }
  70% { opacity: 0.97; }
  85% { opacity: 0.88; }
}

.screen {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

.logo {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(1rem, 3.5vw, 1.5rem);
  color: var(--candle);
  text-shadow: 0 0 12px rgba(240, 184, 77, 0.5), 2px 2px 0 var(--wood-deep);
  letter-spacing: 2px;
}

.tavern-panel {
  margin: auto;
  padding: 2rem;
  max-width: 460px;
  width: 90%;
  background:
    repeating-linear-gradient(
      92deg,
      transparent,
      transparent 8px,
      rgba(0, 0, 0, 0.04) 8px,
      rgba(0, 0, 0, 0.04) 9px
    ),
    linear-gradient(180deg, var(--wood-light) 0%, var(--wood-mid) 55%, var(--wood-dark) 100%);
  border: 4px solid var(--wood-deep);
  box-shadow:
    inset 0 1px 0 rgba(240, 184, 77, 0.15),
    0 0 40px rgba(240, 184, 77, 0.08),
    8px 8px 0 var(--shadow);
  text-align: center;
}

.tavern-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid rgba(240, 184, 77, 0.25);
}

.tavern-badge {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.38rem;
  color: var(--candle);
  letter-spacing: 1px;
}

.candle-icon {
  animation: iconFlicker 3s ease-in-out infinite;
}

@keyframes iconFlicker {
  50% { opacity: 0.7; filter: brightness(0.85); }
}

.tagline {
  margin: 0.6rem 0 1rem;
  color: var(--parchment);
  font-size: 1.05rem;
  letter-spacing: 2px;
  opacity: 0.8;
}

.scroll-box {
  text-align: left;
  background: var(--parchment);
  border: 3px solid var(--wood-deep);
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  box-shadow: inset 0 0 16px rgba(26, 16, 8, 0.12);
}

.scroll-line { color: var(--ink); font-size: 1.05rem; margin-bottom: 0.25rem; }
.scroll-line.muted { color: var(--ink-muted); font-size: 0.95rem; }

.field-label {
  display: block;
  text-align: left;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.4rem;
  color: var(--candle);
  margin-bottom: 0.35rem;
  letter-spacing: 1px;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-dark) 100%);
  border: 3px solid var(--wood-deep);
  color: var(--ink);
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  outline: none;
  margin-bottom: 0.9rem;
  box-shadow: inset 0 2px 6px rgba(26, 16, 8, 0.2);
}

input:focus, textarea:focus {
  border-color: var(--candle);
  box-shadow: inset 0 2px 6px rgba(26, 16, 8, 0.2), 0 0 12px rgba(240, 184, 77, 0.25);
}

textarea {
  min-height: 90px;
  resize: vertical;
  margin-bottom: 1rem;
}

.auth-error {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.42rem;
  color: var(--cream);
  background: var(--burgundy);
  border: 3px solid var(--wood-deep);
  margin-bottom: 1rem;
  line-height: 1.6;
  padding: 0.6rem;
}

.auth-error.shake { animation: shake 0.4s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.tavern-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  padding: 0.85rem 1.1rem;
  background: linear-gradient(180deg, var(--wood-grain) 0%, var(--wood-mid) 60%, var(--wood-dark) 100%);
  border: 3px solid var(--wood-deep);
  border-bottom-width: 5px;
  color: var(--cream);
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 16px rgba(240, 184, 77, 0.1), 3px 3px 0 var(--shadow);
  width: 100%;
}

.tavern-btn-sm {
  width: auto;
  font-size: 0.44rem;
  padding: 0.65rem 0.85rem;
  white-space: nowrap;
}

.tavern-btn:hover:not(:disabled) {
  color: var(--candle);
  box-shadow: 0 0 20px rgba(240, 184, 77, 0.25), 3px 3px 0 var(--shadow);
}

.tavern-btn:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 3px;
}

.tavern-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Экран входа: фокус полей и кнопка входа --- */
#login-screen .login-field:focus {
  border: 2px solid var(--candle);
  outline: none;
  box-shadow:
    inset 0 2px 6px rgba(26, 16, 8, 0.2),
    0 0 0 1px rgba(139, 90, 43, 0.45),
    0 0 14px rgba(240, 184, 77, 0.35);
}

#login-screen .login-field::placeholder {
  color: rgba(92, 74, 56, 0.55);
  font-style: italic;
}

#login-screen .login-submit {
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, border-bottom-width 0.1s ease;
}

#login-screen .login-submit:hover:not(:disabled) {
  background: linear-gradient(180deg, #9a7048 0%, #7a5838 55%, #5c4028 100%);
  color: #ffe8a8;
  box-shadow: 0 0 24px rgba(240, 184, 77, 0.35), 3px 3px 0 var(--shadow);
}

#login-screen .login-submit:active:not(:disabled) {
  transform: translateY(3px);
  border-bottom-width: 2px;
  box-shadow: 0 0 10px rgba(240, 184, 77, 0.2), 1px 1px 0 var(--shadow);
}

#login-error {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.42rem;
  line-height: 1.6;
  color: #c43c3c;
  text-align: center;
  margin-bottom: 0.75rem;
  text-shadow: 0 0 8px rgba(255, 76, 76, 0.35);
}

#login-error.shake {
  animation: shake 0.4s ease;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.tavern-header-bar {
  padding: 1rem 1.4rem;
  background:
    linear-gradient(180deg, var(--wood-mid) 0%, var(--wood-dark) 100%);
  border-bottom: 4px solid var(--wood-deep);
  text-align: center;
}

.tavern-header-bar h1 {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.55rem, 2.5vw, 0.75rem);
  color: var(--candle);
  text-shadow: 0 0 10px rgba(240, 184, 77, 0.4);
}

.hall-greeting {
  margin-top: 0.5rem;
  font-size: 1.2rem;
  color: var(--parchment);
}

.hall-main {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.hall-actions {
  margin-bottom: 1.2rem;
}

.invite-btn {
  background: linear-gradient(180deg, #5c3d1e 0%, var(--burgundy) 50%, #4a2020 100%);
  border-color: var(--candle);
  color: var(--candle);
  font-size: 0.48rem;
  animation: invitePulse 3s ease-in-out infinite;
}

@keyframes invitePulse {
  50% { box-shadow: 0 0 24px rgba(240, 184, 77, 0.35), 3px 3px 0 var(--shadow); }
}

.hall-subtitle {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.48rem;
  color: var(--candle);
  margin-bottom: 1rem;
  text-align: center;
}

.hall-error {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.42rem;
  color: var(--cream);
  background: var(--burgundy);
  border: 2px solid var(--candle);
  padding: 0.7rem;
  margin-bottom: 1rem;
  text-align: center;
}




.table-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.table-list li {
  display: flex;
  justify-content: center;
}

.table-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.25rem 1rem;
  padding: 1rem 1.2rem;
  text-align: left;
  border: 4px solid var(--wood-deep);
  color: var(--cream);
  cursor: pointer;
  font-family: 'VT323', monospace;
  image-rendering: pixelated;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}

.table-btn::after {
  content: '';
  position: absolute;
  inset: 4px;
  pointer-events: none;
  border: 1px dashed rgba(0, 0, 0, 0.12);
}

.table-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.table-btn.table-full {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Барная стойка — тёмное лакированное дерево */
.table-btn.table-bar {
  max-width: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      #120a06 0px,
      #120a06 6px,
      #1f120c 6px,
      #1f120c 12px
    ),
    linear-gradient(180deg, #3a2218 0%, #1a0e08 45%, #0d0704 100%);
  border-color: #080403;
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 180, 0.07),
    inset 0 -3px 8px rgba(0, 0, 0, 0.5),
    0 0 18px rgba(80, 40, 20, 0.25),
    4px 4px 0 var(--shadow);
}

.table-btn.table-bar:hover:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 180, 0.1),
    0 0 24px rgba(240, 184, 77, 0.15),
    4px 4px 0 var(--shadow);
}

.table-btn.table-bar .table-name { color: #e8c878; }

/* Малые столы — светлый дуб */
.table-btn.table-small {
  max-width: 340px;
  background:
    repeating-linear-gradient(
      88deg,
      transparent,
      transparent 5px,
      rgba(90, 60, 30, 0.06) 5px,
      rgba(90, 60, 30, 0.06) 6px
    ),
    linear-gradient(180deg, #d4b88a 0%, #b8956a 50%, #9a7a52 100%);
  border-color: #6b5030;
  color: var(--ink);
  box-shadow: 3px 3px 0 rgba(60, 40, 20, 0.35);
}

.table-btn.table-small .table-name { color: #5c3d1e; }
.table-btn.table-small .table-seats { color: #3d2810; }
.table-btn.table-small .table-type { color: #6b5344; }

/* Большие столы — круглый широкий */
.table-btn.table-large {
  width: min(100%, 520px);
  min-height: 110px;
  border-radius: 50% / 28%;
  padding: 1.4rem 2rem;
  background:
    radial-gradient(ellipse at 50% 30%, #c9a06a 0%, #a07848 55%, #7a5838 100%);
  border-color: #5c4028;
  border-width: 5px;
  box-shadow:
    inset 0 -8px 16px rgba(60, 35, 15, 0.25),
    0 0 20px rgba(240, 184, 77, 0.1),
    5px 5px 0 var(--shadow);
}

.table-btn.table-large:hover:not(:disabled) {
  box-shadow:
    inset 0 -8px 16px rgba(60, 35, 15, 0.2),
    0 0 28px rgba(240, 184, 77, 0.22),
    5px 5px 0 var(--shadow);
}

.table-name {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.48rem;
  color: var(--candle);
  grid-column: 1;
}

.table-seats {
  font-size: 1.35rem;
  color: var(--parchment);
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.table-type {
  font-size: 1rem;
  color: var(--ink-muted);
  grid-column: 1;
}

/* Зоны за столом */
#table-screen.zone-bar .chat-panel {
  background:
    repeating-linear-gradient(90deg, #100804 0, #100804 8px, #1a0e08 8px, #1a0e08 16px),
    linear-gradient(180deg, #2a1810 0%, #120a06 100%);
}

#table-screen.zone-bar .messages {
  background: rgba(20, 12, 8, 0.85);
  color: var(--cream);
  border-color: #080403;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
}

#table-screen.zone-bar .msg { color: var(--cream); }
#table-screen.zone-bar .msg .name { color: #e8c878; }

#table-screen.zone-small .chat-panel {
  background: linear-gradient(180deg, #b8956a 0%, #8a6840 100%);
}

#table-screen.zone-small .messages {
  background:
    repeating-linear-gradient(87deg, transparent, transparent 4px, rgba(120, 90, 50, 0.08) 4px, rgba(120, 90, 50, 0.08) 5px),
    linear-gradient(180deg, #e8d8b0 0%, #d4bc8a 100%);
}

#table-screen.zone-large .bar-layout {
  grid-template-columns: 200px 1fr;
}

#table-screen.zone-large .chat-panel {
  background: radial-gradient(ellipse at 50% 0%, #a07848 0%, #6b4a2a 70%);
  padding: 0.5rem;
}

#table-screen.zone-large .messages {
  border-radius: 50% / 12%;
  border-width: 5px;
  min-height: 0;
  box-shadow: inset 0 0 40px rgba(60, 35, 15, 0.2);
}

/* Пиксельная кружка у никнейма */
.msg .name {
  position: relative;
  padding-left: 18px;
}

.msg .name::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 8px;
  background: #c9a227;
  border-radius: 1px;
  box-shadow:
    6px 0 0 0 #8b5e34,
    0 8px 0 0 #6b4423,
    6px 8px 0 0 #5c3d1e,
    3px -3px 0 0 #f5ead6,
    3px 10px 0 0 #4a3020;
}

/* Toast error over modal */
.toast-error {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.42rem;
  color: #fff;
  background: #8b1a1a;
  border: 3px solid #ff4444;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.8rem;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 0 16px rgba(255, 68, 68, 0.4);
}

.toast-error.shake { animation: shake 0.4s ease; }

.modal-panel { position: relative; }

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.table-occupancy {
  margin-top: 0.4rem;
  font-size: 1.1rem;
  color: var(--parchment);
}

.bar-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.patrons-panel {
  background: linear-gradient(180deg, var(--wood-dark) 0%, var(--wood-deep) 100%);
  border-right: 4px solid var(--wood-deep);
  padding: 1rem;
  overflow-y: auto;
}

.patrons-panel h2 {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.44rem;
  color: var(--candle);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px dashed rgba(240, 184, 77, 0.25);
}

#patron-list { list-style: none; }

#patron-list li {
  padding: 0.35rem 0;
  font-size: 1.15rem;
  color: var(--parchment);
  border-bottom: 1px dotted rgba(240, 184, 77, 0.15);
}

#patron-list li::before {
  content: '🕯 ';
  font-size: 0.8rem;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--wood-deep);
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.3rem;
  margin: 0.7rem;
  margin-bottom: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(92, 74, 56, 0.1) 27px, rgba(92, 74, 56, 0.1) 28px),
    var(--parchment);
  border: 4px solid var(--wood-deep);
  box-shadow: inset 0 0 24px rgba(26, 16, 8, 0.15), 0 0 20px rgba(240, 184, 77, 0.05);
  color: var(--ink);
}

.msg {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  line-height: 1.45;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg .name { color: var(--burgundy); font-weight: bold; }
.msg .time { color: var(--ink-muted); font-size: 0.9rem; margin-left: 0.4rem; }
.msg.system { color: var(--ink-muted); font-style: italic; }
.msg.cheers { color: var(--burgundy); font-weight: bold; }

/* Экран стола: фиксированная высота viewport, скролл только у истории чата */
#table-screen {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

#table-screen > .table-header {
  flex-shrink: 0;
}

#table-screen .bar-layout {
  flex: 1 1 auto;
  min-height: 0;
}

#table-screen .patrons-panel {
  min-height: 0;
}

#table-screen .chat-panel {
  min-height: 0;
}

/* Нижняя панель (кнопки + ввод) — всегда видна, не сжимается */
.chat-composer {
  flex-shrink: 0;
  border-top: 2px solid rgba(42, 24, 16, 0.35);
  background: inherit;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem;
  align-items: flex-end;
  flex-wrap: nowrap;
}

.chat-form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* Поле ввода: растёт до 5 строк, дальше скролл внутри поля */
.chat-form #message-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 2.4rem;
  max-height: 120px;
  margin-bottom: 0;
  resize: none;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.35;
  word-break: break-word;
}

.chat-form input { flex: 1; min-width: 0; margin-bottom: 0; }

.toast-trigger { border-color: var(--candle); color: var(--candle); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 2, 0.7);
}

.tavern-panel-inner {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 420px;
  padding: 1.5rem;
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood-mid) 100%);
  border: 4px solid var(--wood-deep);
  box-shadow: 0 0 30px rgba(240, 184, 77, 0.15);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  color: var(--candle);
  text-align: center;
  margin-bottom: 0.6rem;
}

.modal-hint {
  text-align: center;
  color: var(--parchment);
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.toast-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 2500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.toast-banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.toast-banner.fade-out {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9) translateY(-12px);
}

.toast-sign {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 1.5rem;
  background: var(--parchment);
  border: 4px solid var(--wood-deep);
  box-shadow: 0 0 0 2px var(--candle), 0 0 30px rgba(240, 184, 77, 0.3), 8px 8px 0 var(--shadow);
  max-width: min(90vw, 520px);
}

.toast-sign-icon { font-size: 2rem; flex-shrink: 0; }

.toast-sign-text {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.42rem, 2.5vw, 0.55rem);
  color: var(--ink);
  line-height: 1.7;
}

.copy-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 4000;
  padding: 0.8rem 1.4rem;
  background: var(--wood-mid);
  border: 3px solid var(--candle);
  color: var(--candle);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  box-shadow: 0 0 24px rgba(240, 184, 77, 0.35);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

.copy-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .bar-layout { grid-template-columns: 1fr; }
  .patrons-panel { display: none; }
  .chat-form { flex-wrap: wrap; }
  .chat-form-actions {
    flex-direction: row;
    width: 100%;
  }
  .chat-form-actions .tavern-btn-sm { flex: 1; }
  .tavern-btn-sm { width: 100%; }
  
.table-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.table-list li {
  display: flex;
  justify-content: center;
}

.table-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.25rem 1rem;
  padding: 1rem 1.2rem;
  text-align: left;
  border: 4px solid var(--wood-deep);
  color: var(--cream);
  cursor: pointer;
  font-family: 'VT323', monospace;
  image-rendering: pixelated;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}

.table-btn::after {
  content: '';
  position: absolute;
  inset: 4px;
  pointer-events: none;
  border: 1px dashed rgba(0, 0, 0, 0.12);
}

.table-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.table-btn.table-full {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Барная стойка — тёмное лакированное дерево */
.table-btn.table-bar {
  max-width: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      #120a06 0px,
      #120a06 6px,
      #1f120c 6px,
      #1f120c 12px
    ),
    linear-gradient(180deg, #3a2218 0%, #1a0e08 45%, #0d0704 100%);
  border-color: #080403;
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 180, 0.07),
    inset 0 -3px 8px rgba(0, 0, 0, 0.5),
    0 0 18px rgba(80, 40, 20, 0.25),
    4px 4px 0 var(--shadow);
}

.table-btn.table-bar:hover:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 180, 0.1),
    0 0 24px rgba(240, 184, 77, 0.15),
    4px 4px 0 var(--shadow);
}

.table-btn.table-bar .table-name { color: #e8c878; }

/* Малые столы — светлый дуб */
.table-btn.table-small {
  max-width: 340px;
  background:
    repeating-linear-gradient(
      88deg,
      transparent,
      transparent 5px,
      rgba(90, 60, 30, 0.06) 5px,
      rgba(90, 60, 30, 0.06) 6px
    ),
    linear-gradient(180deg, #d4b88a 0%, #b8956a 50%, #9a7a52 100%);
  border-color: #6b5030;
  color: var(--ink);
  box-shadow: 3px 3px 0 rgba(60, 40, 20, 0.35);
}

.table-btn.table-small .table-name { color: #5c3d1e; }
.table-btn.table-small .table-seats { color: #3d2810; }
.table-btn.table-small .table-type { color: #6b5344; }

/* Большие столы — круглый широкий */
.table-btn.table-large {
  width: min(100%, 520px);
  min-height: 110px;
  border-radius: 50% / 28%;
  padding: 1.4rem 2rem;
  background:
    radial-gradient(ellipse at 50% 30%, #c9a06a 0%, #a07848 55%, #7a5838 100%);
  border-color: #5c4028;
  border-width: 5px;
  box-shadow:
    inset 0 -8px 16px rgba(60, 35, 15, 0.25),
    0 0 20px rgba(240, 184, 77, 0.1),
    5px 5px 0 var(--shadow);
}

.table-btn.table-large:hover:not(:disabled) {
  box-shadow:
    inset 0 -8px 16px rgba(60, 35, 15, 0.2),
    0 0 28px rgba(240, 184, 77, 0.22),
    5px 5px 0 var(--shadow);
}

.table-name {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.48rem;
  color: var(--candle);
  grid-column: 1;
}

.table-seats {
  font-size: 1.35rem;
  color: var(--parchment);
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.table-type {
  font-size: 1rem;
  color: var(--ink-muted);
  grid-column: 1;
}

/* Зоны за столом */
#table-screen.zone-bar .chat-panel {
  background:
    repeating-linear-gradient(90deg, #100804 0, #100804 8px, #1a0e08 8px, #1a0e08 16px),
    linear-gradient(180deg, #2a1810 0%, #120a06 100%);
}

#table-screen.zone-bar .messages {
  background: rgba(20, 12, 8, 0.85);
  color: var(--cream);
  border-color: #080403;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
}

#table-screen.zone-bar .msg { color: var(--cream); }
#table-screen.zone-bar .msg .name { color: #e8c878; }

#table-screen.zone-small .chat-panel {
  background: linear-gradient(180deg, #b8956a 0%, #8a6840 100%);
}

#table-screen.zone-small .messages {
  background:
    repeating-linear-gradient(87deg, transparent, transparent 4px, rgba(120, 90, 50, 0.08) 4px, rgba(120, 90, 50, 0.08) 5px),
    linear-gradient(180deg, #e8d8b0 0%, #d4bc8a 100%);
}

#table-screen.zone-large .bar-layout {
  grid-template-columns: 200px 1fr;
}

#table-screen.zone-large .chat-panel {
  background: radial-gradient(ellipse at 50% 0%, #a07848 0%, #6b4a2a 70%);
  padding: 0.5rem;
}

#table-screen.zone-large .messages {
  border-radius: 50% / 12%;
  border-width: 5px;
  min-height: 0;
  box-shadow: inset 0 0 40px rgba(60, 35, 15, 0.2);
}

/* Пиксельная кружка у никнейма */
.msg .name {
  position: relative;
  padding-left: 18px;
}

.msg .name::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 8px;
  background: #c9a227;
  border-radius: 1px;
  box-shadow:
    6px 0 0 0 #8b5e34,
    0 8px 0 0 #6b4423,
    6px 8px 0 0 #5c3d1e,
    3px -3px 0 0 #f5ead6,
    3px 10px 0 0 #4a3020;
}

/* Toast error over modal */
.toast-error {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.42rem;
  color: #fff;
  background: #8b1a1a;
  border: 3px solid #ff4444;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.8rem;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 0 16px rgba(255, 68, 68, 0.4);
}

.toast-error.shake { animation: shake 0.4s ease; }

.modal-panel { position: relative; }

.table-header { flex-direction: column; gap: 0.8rem; align-items: stretch; }
}

/* Toast modal actions */
.modal-actions-stack {
  flex-direction: column;
  align-items: stretch;
}

.toast-local-btn {
  border-color: var(--wood-grain);
  color: var(--parchment);
}

.toast-global-btn {
  border-color: #8b1a1a;
  color: #e8c040;
  background: linear-gradient(180deg, #5c2020 0%, #3d1212 100%);
}

.toast-global-btn:hover:not(:disabled) {
  color: #ffd700;
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.35);
}

/* Local toast — over chat, wood tone */
.toast-local-banner {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  max-width: 90%;
}

.chat-panel { position: relative; }

.toast-local-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-local-banner.fade-out {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}

.toast-local-text {
  font-family: 'VT323', monospace;
  font-size: 1.35rem;
  color: var(--wood-mid);
  background: rgba(217, 201, 168, 0.95);
  border: 3px solid var(--wood-grain);
  padding: 0.7rem 1.2rem;
  box-shadow: 3px 3px 0 var(--shadow);
}

/* Global toast — epic center overlay */
.toast-global-banner {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 4, 2, 0.72);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.toast-global-banner.show {
  opacity: 1;
  pointer-events: auto;
}

.toast-global-banner.fade-out {
  opacity: 0;
}

.toast-global-inner {
  text-align: center;
  padding: 2rem 2.5rem;
  max-width: min(92vw, 600px);
  animation: globalPop 0.4s ease;
}

@keyframes globalPop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.toast-global-icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.toast-global-text {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(0.55rem, 3.5vw, 0.85rem);
  color: #ffd700;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.6),
    0 0 40px rgba(139, 26, 26, 0.5),
    3px 3px 0 #5c1010;
  line-height: 1.8;
  white-space: pre-line;
}

body.global-toast-active .chat-form,
body.global-toast-active .messages {
  filter: blur(2px) brightness(0.6);
  pointer-events: none;
}

/* NPC / system messages */
.msg.npc {
  color: #8a8078;
  font-style: italic;
  font-size: 1.05rem;
  opacity: 0.85;
}

.npc-prefix {
  color: #6e6860;
}

.hall-system {
  margin-bottom: 1rem;
  min-height: 0;
}

.npc-line {
  color: #8a8078;
  font-style: italic;
  font-size: 1.05rem;
  padding: 0.3rem 0;
  border-bottom: 1px dotted rgba(138, 128, 120, 0.2);
}

.msg.toast-local-chat {
  color: var(--wood-mid);
  font-style: italic;
}

.msg.toast-global-chat {
  color: #8b1a1a;
  font-weight: bold;
}

.chat-hint {
  padding: 0.35rem 0.8rem 0.6rem;
  font-size: 0.95rem;
  color: #7a7068;
  font-style: italic;
  opacity: 0.75;
  flex-shrink: 0;
  margin: 0;
}

.msg.game {
  font-weight: bold;
  color: #b87333;
  font-size: 1.25rem;
  text-shadow: 1px 1px 0 rgba(184, 115, 51, 0.2);
  padding: 0.35rem 0;
  border-left: 3px solid #c9a227;
  padding-left: 0.6rem;
  background: rgba(201, 162, 39, 0.08);
}

#table-screen.zone-bar .msg.game {
  color: #e8b85a;
  border-left-color: #e8c878;
  background: rgba(232, 200, 120, 0.1);
}

.hall-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  text-align: left;
}

.hall-header-row h1 {
  flex: 1;
  text-align: center;
}

.coins-badge {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.48rem;
  color: #e8c040;
  background: rgba(20, 12, 8, 0.75);
  border: 2px solid #c9a227;
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(201, 162, 39, 0.2);
}

.table-header {
  gap: 0.6rem;
}

.table-header .coins-badge {
  margin-left: auto;
  margin-right: 0.3rem;
}

.msg.mute {
  color: #8a7068;
  font-style: italic;
  font-size: 1.05rem;
  opacity: 0.9;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.5rem 0.7rem 0.25rem;
  align-items: center;
  flex-shrink: 0;
}

.action-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.38rem;
  padding: 0.55rem 0.7rem;
  background: linear-gradient(180deg, #6b4a2a 0%, #4a3020 55%, #3d2518 100%);
  border: 2px solid #2a1810;
  border-bottom-width: 4px;
  color: var(--cream);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 2px 2px 0 rgba(8, 4, 2, 0.35);
  transition: transform 0.1s, box-shadow 0.1s, color 0.15s;
}

.action-btn:hover {
  color: var(--candle);
  box-shadow: 2px 2px 0 rgba(8, 4, 2, 0.35), 0 0 10px rgba(240, 184, 77, 0.2);
}

.action-btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
  box-shadow: 1px 1px 0 rgba(8, 4, 2, 0.35);
}

#table-screen.zone-bar .action-btn {
  background: linear-gradient(180deg, #3d2518 0%, #2a1810 55%, #1a0e08 100%);
  border-color: #120a06;
  color: #e8c878;
}

#table-screen.zone-small .action-btn {
  background: linear-gradient(180deg, #b8956a 0%, #8a6840 55%, #6b5030 100%);
  border-color: #5c4028;
  color: #2c1810;
}

#table-screen.zone-large .action-btn {
  background: linear-gradient(180deg, #a07848 0%, #7a5838 55%, #5c4028 100%);
}

@media (max-width: 640px) {
  .action-bar { justify-content: center; }
  .action-btn { flex: 1; min-width: 90px; text-align: center; }
}

.action-btn-drinks {
  border-color: #6b4a10;
  color: #f0c060;
}

.action-btn-bar-round {
  border-color: #8a6a20;
  color: #ffe08a;
}

.action-btn-bar-round.hidden {
  display: none;
}

.action-btn-rps {
  border-color: #5a4a6a;
  color: #d8c8ff;
}

.action-btn-rps.hidden {
  display: none;
}

#table-screen.zone-bar .action-btn-rps {
  border-color: #8a7aaa;
  color: #f0e8ff;
}

.rps-panel {
  max-width: 400px;
}

.rps-choices {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.rps-choice-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.42rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, #6b4a2a 0%, #4a3020 55%, #3d2518 100%);
  border: 3px solid var(--wood-deep);
  border-bottom-width: 4px;
  color: var(--cream);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(8, 4, 2, 0.35);
  transition: color 0.15s, box-shadow 0.15s;
}

.rps-choice-btn:hover {
  color: var(--candle);
  box-shadow: 2px 2px 0 rgba(8, 4, 2, 0.35), 0 0 12px rgba(240, 184, 77, 0.25);
}

.action-btn-cards {
  border-color: #2d4a6a;
  color: #b8d8ff;
}

.action-btn-cards.hidden {
  display: none;
}

#table-screen.zone-small .action-btn-cards {
  border-color: #4a6080;
  color: #e0f0ff;
}

.cards-game-panel {
  max-width: 460px;
}

.cards-lobby-players {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  text-align: center;
}

.cards-lobby-players li {
  font-family: 'VT323', monospace;
  font-size: 1.15rem;
  color: var(--parchment);
  padding: 0.25rem 0;
}

.cards-game-play.hidden,
.cards-lobby-actions .hidden {
  display: none;
}

.cards-turn-info,
.cards-last-play {
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 1.15rem;
  color: var(--cream);
  margin: 0.35rem 0;
}

.cards-pile-label,
.cards-hand-label {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.38rem;
  color: var(--candle);
  margin: 0.5rem 0 0.35rem;
}

.cards-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  min-height: 76px;
}

.card {
  width: 50px;
  height: 70px;
  background: #fff;
  border: 1px solid #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  font-weight: bold;
  color: #1a1010;
  border-radius: 4px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
  user-select: none;
  transition: transform 0.1s, box-shadow 0.1s;
}

.card:hover {
  transform: translateY(-3px);
}

.card.selected {
  outline: 3px solid var(--candle);
  box-shadow: 0 0 12px rgba(240, 184, 77, 0.45);
  transform: translateY(-6px);
}

.cards-rank-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  font-family: 'VT323', monospace;
  color: var(--parchment);
}

.cards-rank-field select {
  margin-bottom: 0;
  min-width: 5rem;
}

.cards-play-actions {
  flex-wrap: wrap;
}

.cards-bluff-btn {
  border-color: #8b1a1a;
  color: #ffb0b0;
}

.cards-game-play.disabled .cards-play-actions,
.cards-game-play.disabled .cards-hand {
  opacity: 0.45;
  pointer-events: none;
}

#table-screen.zone-bar .action-btn-bar-round {
  border-color: #c9a030;
  color: #fff0a0;
  box-shadow: 2px 2px 0 rgba(8, 4, 2, 0.35), 0 0 12px rgba(240, 200, 80, 0.2);
}

.msg.bar-round-event {
  color: #d4a830;
  font-weight: bold;
  font-style: italic;
  text-shadow: 0 0 8px rgba(240, 184, 77, 0.35);
  border-left: 3px solid var(--candle);
  padding: 0.4rem 0.6rem;
  background: rgba(240, 184, 77, 0.08);
}

#table-screen.zone-bar .msg.bar-round-event {
  color: #ffe566;
  background: rgba(232, 200, 120, 0.12);
}

.drinks-panel {
  max-width: 480px;
}

.drinks-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.drink-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: linear-gradient(180deg, rgba(42, 24, 16, 0.35) 0%, rgba(26, 14, 8, 0.5) 100%);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.25), 2px 2px 0 rgba(8, 4, 2, 0.3);
}

.drink-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.drink-name {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.42rem;
  color: var(--candle);
  line-height: 1.5;
}

.drink-price {
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: #e8c878;
}

.drink-desc {
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  color: var(--parchment);
  opacity: 0.9;
}

.drink-buy-btn {
  flex-shrink: 0;
  border-color: var(--candle);
  color: var(--candle);
}

.drink-buy-btn:hover {
  background: rgba(240, 184, 77, 0.15);
}

.nick-dragon {
  color: #8B4513;
  text-shadow: 1px 1px 2px #ff4500;
  font-weight: bold;
}

.action-btn-fortune {
  border-color: #6b3a8a;
  color: #e8b0ff;
  animation: fortunePulse 1.8s ease-in-out infinite;
}

.action-btn-fortune.hidden {
  display: none;
}

@keyframes fortunePulse {
  0%, 100% { box-shadow: 2px 2px 0 rgba(8, 4, 2, 0.35); }
  50% { box-shadow: 2px 2px 0 rgba(8, 4, 2, 0.35), 0 0 14px rgba(200, 140, 255, 0.45); }
}

.action-btn-dice {
  border-color: #4a5c8a;
  color: #b8d0ff;
}

.action-btn-accept-dice {
  border-color: #3d5a8a;
  color: #a8d8ff;
}

.action-btn-accept-dice.hidden {
  display: none;
}

.liars-dice-panel {
  max-width: 440px;
}

.liars-dice-opponent {
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: var(--parchment);
  margin-bottom: 0.75rem;
}

.liars-dice-section {
  margin-bottom: 0.75rem;
}

.liars-dice-label {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.38rem;
  color: var(--candle);
  margin-bottom: 0.45rem;
}

.liars-dice-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  min-height: 38px;
}

.dice-cube {
  width: 30px;
  height: 30px;
  background: #eee;
  color: #000;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
  margin: 2px;
  font-weight: bold;
  border: 2px solid #888;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
}

.liars-dice-bid-text {
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 1.15rem;
  color: var(--cream);
  margin: 0.5rem 0 0.75rem;
  min-height: 1.4rem;
}

.liars-dice-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  justify-content: center;
}

.liars-dice-controls.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.liars-dice-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--parchment);
}

.liars-dice-field input,
.liars-dice-field select {
  margin-bottom: 0;
  min-width: 4.5rem;
  font-size: 1.1rem;
}

.liars-bluff-btn {
  border-color: #8b1a1a;
  color: #ffb0b0;
}

.liars-dice-turn-hint {
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  color: #a8c878;
  margin-top: 0.65rem;
  min-height: 1.2rem;
}

.action-btn-bet {
  border-color: #8b1a1a;
  color: #e8c040;
}

.action-btn-accept {
  border-color: #2d6b2d;
  color: #a8e6a8;
  animation: acceptPulse 1.5s ease-in-out infinite;
}

.action-btn-accept.hidden {
  display: none;
}

@keyframes acceptPulse {
  50% { box-shadow: 0 0 12px rgba(168, 230, 168, 0.35); }
}

.name-clickable {
  font-family: inherit;
  font-size: inherit;
  font-weight: bold;
  color: var(--burgundy);
  background: none;
  border: none;
  border-bottom: 1px dashed var(--gold);
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-decoration: none;
}

.name-clickable:hover {
  color: var(--gold);
}

#table-screen.zone-bar .name-clickable {
  color: #e8c878;
}

.msg.system-table {
  color: #6b5344;
  font-style: italic;
  font-size: 1.1rem;
  padding: 0.3rem 0;
}

#table-screen.zone-bar .msg.system-table {
  color: #c4b08a;
}

.action-btn-work {
  border-color: #5c6b3a;
  color: #d4e8a0;
}

.action-btn-work:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.msg.beg {
  color: #7a5c8a;
  font-style: italic;
  font-size: 1.15rem;
  padding: 0.4rem 0.5rem;
  border-left: 3px solid #9a7ab0;
  background: rgba(122, 92, 138, 0.08);
}

.msg.beg .name-clickable {
  color: #7a5c8a;
  border-bottom-color: #9a7ab0;
}

.name-admin,
.msg.admin-msg .name,
.msg.admin-msg .name-clickable {
  color: #ffd700 !important;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.45), 1px 1px 0 #8b1a1a;
}

.admin-crown {
  margin-right: 4px;
  font-size: 0.95em;
  vertical-align: middle;
}

.msg.admin-msg {
  border-left: 3px solid #ffd700;
  padding-left: 0.5rem;
  background: rgba(255, 215, 0, 0.06);
}

#table-screen.zone-bar .msg.admin-msg .name-admin,
#table-screen.zone-bar .msg.admin-msg .name-clickable {
  color: #ffe566 !important;
}
