:root {
  --sidebar-width: 220px;
  color-scheme: light dark;
  --bg: #0f172a;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.1);
  --accent: #38bdf8;
  --danger: #f87171;
  --text: #f1f5f9;
  --muted: rgba(241, 245, 249, 0.6);
  font-family: "Inter", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.3), rgba(15, 23, 42, 0.95));
  min-height: 100vh;
  color: var(--text);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.8rem;
}

.app__main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 0.85rem;
  backdrop-filter: blur(12px);
}

.card h2,
.card h3 {
  margin-top: 0;
}

.hidden {
  display: none;
}

.lobby {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.lobby__block {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 0.8rem;
  padding: 1rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
}

.field__label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

input,
button {
  border-radius: 0.6rem;
  border: 1px solid transparent;
  font-size: 1rem;
  padding: 0.6rem;
  font-family: inherit;
}

input {
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.08);
}

button {
  background: var(--accent);
  color: #041421;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
}

.status-pill {
  display: inline-block;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 0.78rem;
  margin-right: 0.5rem;
}

.danger {
  background: var(--danger);
  color: #320202;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.room-item {
  padding: 0.5rem;
  border-radius: 0.6rem;
  background: rgba(56, 189, 248, 0.1);
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.room-item:hover {
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

.room-item__id {
  font-size: 0.8rem;
  color: var(--muted);
}

.table-view {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.table__hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.table__hud .ghost-button {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

.table__hud-left h2 {
  margin: 0;
  font-size: 1rem;
}

.table__hud-left p {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.hud__actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.hud__buttons {
  display: flex;
  gap: 0.4rem;
}

.hud__buttons button {
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
}

.hud__buttons button.active {
  background: var(--accent);
  color: #062133;
}

.table__surface {
  position: relative;
  border-radius: 32px;
  background: radial-gradient(circle at 50% 30%, rgba(8, 102, 72, 0.95), rgba(2, 30, 25, 0.95));
  padding: 1rem;
  border: 3px solid rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45);
  min-height: 320px;
}

.surface__overlay {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #f8fafc;
  pointer-events: none;
}

.surface__phase {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.surface__pot {
  font-size: 1.2rem;
  font-weight: 600;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 2.4rem;
}

.player-card {
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(10, 16, 30, 0.95), rgba(15, 24, 42, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.45);
  padding: 0.8rem;
  color: #f8fafc;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.player-card.active {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
}

.player-card.folded {
  opacity: 0.35;
}

.player-card.me {
  border-color: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.6);
}

.player-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-card__name {
  font-weight: 600;
}

.player-card__stack {
  font-size: 0.8rem;
  opacity: 0.8;
}

.player-card__status {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.player-card__hand {
  display: flex;
  gap: 0.35rem;
}

.player-card__hand .playing-card {
  width: 42px;
  height: 60px;
  box-shadow: none;
  border-width: 1px;
}

.player-card__hand .playing-card .suit-large {
  font-size: 1.6rem;
}

.hand-panel {
  border-radius: 1rem;
  background: rgba(12, 21, 31, 0.75);
  border: 1px solid var(--card-border);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.hand-panel__cards {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hand-panel__draw {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.hand-panel__draw button {
  padding: 0.45rem;
  font-size: 0.9rem;
}

.playing-card {
  position: relative;
  width: 54px;
  height: 74px;
  border-radius: 0.5rem;
  border: 2px solid #f8fafc;
  background: #fdfdfd;
  color: #0f172a;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.playing-card .corner {
  position: absolute;
  top: 0.2rem;
  left: 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.playing-card .corner .rank {
  font-size: 1rem;
}

.playing-card .suit-large {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  width: 100%;
  margin-top: 0.2rem;
}

.playing-card.suit-hearts,
.playing-card.suit-diamonds {
  color: #dc2626;
}

.playing-card.suit-spades,
.playing-card.suit-clubs {
  color: #111;
}

.playing-card.card-back {
  background: repeating-linear-gradient(45deg, #dc2626, #dc2626 6px, #b91c1c 6px, #b91c1c 12px);
  border-color: #fee2e2;
  color: transparent;
}

.playing-card.selected {
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.7);
}

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.actions button {
  font-size: 0.95rem;
  padding: 0.55rem 0.6rem;
}

.draw {
  margin-top: 0.8rem;
  padding: 0.8rem;
  border: 1px dashed var(--card-border);
  border-radius: 0.7rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.draw__buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.draw__buttons button {
  flex: 1;
}

.action-tray {
  position: sticky;
  bottom: 10px;
  background: rgba(6, 12, 19, 0.75);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.4);
  padding: 0.4rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.action-tray button {
  padding: 0.5rem 0.6rem;
  font-size: 0.95rem;
}

.form-row {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  :root {
    --sidebar-width: 0px;
  }

  .app__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .app__header h1 {
    font-size: 1rem;
  }

  .app__subtitle {
    font-size: 0.75rem;
  }

  .table__felt {
    padding: 1rem;
    min-height: 360px;
  }

  .table__hud h2 {
    font-size: 0.95rem;
  }

  .table__hud p {
    font-size: 0.75rem;
  }

  .hud__actions button {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }

  .felt__players {
    position: static;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.5rem 0;
  }

  .player-card {
    width: calc(50% - 0.5rem);
    min-width: 140px;
  }

  .action-tray {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .action-tray button {
    font-size: 0.85rem;
    padding: 0.4rem 0.45rem;
  }

  .draw__buttons {
    flex-direction: column;
  }

  .table__hand {
    padding: 0.8rem;
  }

  .hand {
    gap: 0.35rem;
  }

  .playing-card {
    width: 44px;
    height: 64px;
  }

  .ghost-button,
  button {
    font-size: 0.9rem;
    padding: 0.45rem 0.7rem;
  }
}
.table__log {
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 0.6rem;
  background: rgba(12, 18, 32, 0.7);
  margin-top: 0.6rem;
}

#logArea {
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.82rem;
  padding: 0.4rem;
}

.log-entry {
  margin: 0.2rem 0;
  padding-bottom: 0.2rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}
