:root {
  --bg: #0b0c10;
  --panel: #151820;
  --accent: #9f7aea;
  --accent-2: #7dd3fc;
  --text: #e8ecf2;
  --muted: #9aa3b5;
  --danger: #f87171;
  --success: #34d399;
  --grid: #1f2430;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(127, 90, 240, 0.12), transparent 30%),
              radial-gradient(circle at 80% 10%, rgba(125, 211, 252, 0.12), transparent 30%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
header h1 { margin: 0 0 6px; letter-spacing: 1px; }
header p { margin: 0; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
}

.form-header, .mode-actions {
  flex-wrap: wrap;
}
.form-header strong, .mode-actions button {
  white-space: nowrap;
}

.field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
label { color: var(--muted); font-size: 14px; }
input {
  background: #0f1117;
  border: 1px solid #262c3a;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 16px;
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', system-ui, -apple-system, sans-serif;
}
input::placeholder { color: var(--muted); }
input:invalid { border-color: rgba(248, 113, 113, 0.6); }
.mode-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}
.mode-toggle input { margin-right: 6px; }
.mode-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.mode-actions.hidden { display: none; }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid #262c3a;
}
button.danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.7); }
button.small { padding: 8px 10px; font-size: 14px; }
.room-row { display: flex; gap: 8px; align-items: center; }
.room-row input { flex: 1; }
.name-row { display: flex; gap: 8px; align-items: center; }
.name-row input { flex: 1; }
button.hidden, .hidden { display: none !important; }
.copyable {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 600;
}
.action-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.emoji-row { display: flex; gap: 8px; align-items: center; }
.emoji-display {
  flex: 1;
  background: #0f1117;
  border: 1px solid #262c3a;
  border-radius: 10px;
  color: var(--text);
  font-size: 24px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.emoji-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.emoji-item {
  background: #0f1117;
  border: 1px solid #262c3a;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.12s ease, border 0.12s ease;
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', system-ui, -apple-system, sans-serif;
}
.emoji-item:hover { transform: translateY(-1px); border-color: rgba(125, 211, 252, 0.7); }
.emoji-badge {
  display: inline-flex;
  min-width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  background: #0f1117;
  border: 1px solid #262c3a;
  border-radius: 8px;
  font-size: 18px;
  vertical-align: middle;
}
button.hidden { display: none; }
.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}
button {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border: none;
  color: #0b0c10;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:not(:disabled):hover { transform: translateY(-1px); }

.tips { color: var(--muted); margin-top: 8px; min-height: 20px; }
.info-row { margin-top: 8px; }
.panel.info {
  margin-top: 10px;
  border-style: dashed;
  border-color: rgba(125, 211, 252, 0.5);
}
.panel.info ul { margin: 8px 0 0 16px; padding: 0; color: var(--muted); line-height: 1.6; }
.panel.info li { margin-bottom: 4px; }
.info-header { display: flex; justify-content: space-between; align-items: center; }

.topbar { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); margin-bottom: 12px; }
.players { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.player-card {
  padding: 10px 12px;
  background: #0f1117;
  border: 1px solid #262c3a;
  border-radius: 10px;
  min-width: 140px;
}
.player-card .name { font-weight: 600; color: var(--text); }
.player-card .meta { color: var(--muted); font-size: 13px; }
.player-card.dead { border-color: rgba(248, 113, 113, 0.5); opacity: 0.6; }
.player-card.host { border-color: rgba(125, 211, 252, 0.6); }

.controls { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }

.board {
  display: grid;
  gap: 6px;
  background: #0f1117;
  border: 1px solid #262c3a;
  border-radius: 12px;
  padding: 10px;
  max-width: 720px;
}
.cell {
  width: 48px;
  height: 48px;
  background: var(--grid);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.cell:hover { transform: translateY(-1px); }
.cell.revealed { background: #1f2937; }
.cell.poison { background: rgba(248, 113, 113, 0.18); border: 1px solid rgba(248, 113, 113, 0.5); }
.cell.your-poison { box-shadow: inset 0 0 0 2px rgba(159, 122, 234, 0.6); }

@media (max-width: 600px) {
  .board { gap: 4px; padding: 8px; }
  .cell { width: 40px; height: 40px; }
  .panel { padding: 12px; }
  input { width: 100%; }
  button { width: 100%; }
  .controls { flex-direction: column; align-items: flex-start; }
  .room-row, .name-row { flex-direction: column; align-items: stretch; }
  .room-row button, .name-row button { width: 100%; }
  .action-row { flex-direction: column; align-items: stretch; }
}
