:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0f0f12;
  color: #f2f2f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #222, #0a0a0e), url("/assets/backgrounds/table.jpg");
  background-size: cover;
  background-position: center;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.subtitle {
  margin: 0.25rem 0 0;
  color: #c7c7d1;
}

.status {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 1.5rem;
  padding: 1.5rem 2.5rem 2.5rem;
}

.panel {
  background: rgba(18, 18, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.panel-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.actions {
  display: flex;
  gap: 0.75rem;
}

.hidden {
  display: none;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

input {
  background: #12121a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: inherit;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  background: #2a2a38;
  color: inherit;
}

button.primary {
  background: #e0482e;
}

button.secondary {
  background: #3a3a4a;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.player-card {
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(35, 35, 45, 0.9);
}

.player-header {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.player-portrait {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.role-line {
  margin: 0.35rem 0 0;
  font-weight: 600;
  color: #f3b169;
}

.player-card.active {
  border-color: #e0482e;
  box-shadow: 0 0 0 2px rgba(224, 72, 46, 0.25);
}

.player-card.out {
  opacity: 0.5;
}

.hand {
  margin-top: 1.5rem;
}

.hand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hand-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.card {
  background: linear-gradient(145deg, #2b2b3a, #181820);
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.card-image {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 0.6rem;
  background: rgba(255, 255, 255, 0.08);
}

.card:hover {
  border-color: rgba(224, 72, 46, 0.7);
}

.card small {
  color: #bdbdcc;
}

.card .tag {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(224, 72, 46, 0.2);
  font-size: 0.75rem;
  margin-top: 0.4rem;
}

.card-tooltip {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  background: rgba(18, 18, 24, 0.95);
  color: #f9d3c4;
  border: 1px solid rgba(224, 72, 46, 0.6);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  text-align: center;
  z-index: 2;
  pointer-events: none;
}

.suit-badge {
  font-size: 0.85rem;
  font-weight: 700;
  margin-left: 0.3rem;
}

.event-log {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(24, 24, 32, 0.9);
}

.event-list {
  max-height: 180px;
  overflow-y: auto;
  margin-top: 0.5rem;
}

.event-entry {
  margin: 0;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  color: #d4d4de;
}

.event-entry:first-child {
  color: #f2f2f5;
  font-weight: 600;
}

.chat {
  margin-top: 1.5rem;
}

.chat-list {
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}

.chat-entry {
  margin: 0;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  color: #c7c7d1;
}

.chat-row {
  display: flex;
  gap: 0.5rem;
}

.library {
  max-height: calc(100vh - 140px);
  overflow: auto;
}

.library-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.library-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.library-image {
  width: 72px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.library-item {
  padding: 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(32, 32, 44, 0.8);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  background: #1b1b24;
  padding: 1.5rem;
  border-radius: 16px;
  width: min(420px, 90vw);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.target-list {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0;
}

.target-button {
  width: 100%;
  text-align: left;
}

.hint {
  color: #bdbdcc;
}

.equip-tag {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.25);
  color: #93bbfc;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.3rem;
}

.equip-row {
  margin-top: 0.3rem;
}

.distance-label {
  color: #a3a3b3;
  font-size: 0.75rem;
}

.tag.equip {
  background: rgba(59, 130, 246, 0.25);
  color: #93bbfc;
}

.target-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.target-button.selected {
  border: 2px solid #e0482e;
  background: rgba(224, 72, 46, 0.15);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
