/* ============================================================================
   Born from Blood - Online Play
   ============================================================================ */
.online-page { min-height: 100vh; overflow: hidden; }
.online-page header { gap: 10px; }
.mini-action, .main-action {
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  color: var(--text);
}
.mini-action {
  background: var(--surface2);
  padding: 7px 10px;
  font-size: 0.76rem;
}
.mini-action:hover { border-color: var(--accent2); }
.mini-action.danger:hover { border-color: #ef4444; color: #fecaca; }
.main-action {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  padding: 10px 14px;
  font-weight: 800;
}
.main-action:hover { background: #d42a48; }
.online-shell {
  height: calc(100vh - 61px);
  background: radial-gradient(110% 80% at 50% 20%, #211018 0%, var(--bg) 70%);
}
.online-panel {
  width: min(820px, calc(100vw - 28px));
  margin: 24px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.32);
}
.panel-title, .card-title {
  font-family: var(--display);
  font-weight: 800;
  color: var(--text);
}
.panel-title { font-size: 1.25rem; margin-bottom: 12px; }
.card-title { font-size: 0.92rem; margin-bottom: 10px; }
.field-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 12px 0 5px;
}
.text-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}
.text-input:focus { border-color: var(--accent2); }
.text-input.compact { width: 220px; }
.room-code-input { text-transform: uppercase; letter-spacing: .16em; font-weight: 800; }
.soft-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}
.lobby-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.profile-edit { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.lobby-card, .room-card {
  background: rgba(0,0,0,.18);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 13px;
}

.room-view {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  height: calc(100vh - 61px);
  min-height: 0;
}
.room-sidebar {
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.room-kicker {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: .16em;
}
.room-code {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: .14em;
  color: #fff;
}
.room-name { color: var(--accent2); font-weight: 700; }
.room-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.turn-text {
  color: var(--text);
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.35;
}
.log-card { flex: 1; min-height: 170px; }
.log-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--muted);
}
.log-line {
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.04);
  border-radius: 6px;
  padding: 6px 7px;
}

.online-table { min-width: 0; min-height: 0; }
.online-board {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  background: radial-gradient(120% 88% at 50% 50%, #1b0e14 0%, var(--bg) 74%);
  overflow: hidden;
}
.seat-area {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 5px;
  padding: 7px 9px;
}
.seat-area.opponent { background: rgba(123,58,160,.07); }
.seat-area.mine { background: rgba(196,35,63,.06); }
.seat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.75rem;
}
.seat-name { color: var(--text); font-weight: 800; }
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,.24);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text);
}
.stat-pill button {
  width: 21px;
  height: 21px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
}
.field-zone {
  position: relative;
  min-height: 118px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  background: rgba(0,0,0,.18);
  overflow: hidden;
}
.field-zone.drop-hot { border-color: var(--accent2); }
.zone-label {
  position: absolute;
  top: 8px;
  left: 10px;
  color: rgba(171,134,148,.33);
  font-size: 0.68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  pointer-events: none;
}
.hand-zone {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  min-height: 90px;
  overflow-x: auto;
  background: rgba(0,0,0,.28);
  border-radius: 8px;
  padding: 4px;
}
.seat-area.opponent .hand-zone { min-height: 48px; }
.card-mini {
  position: relative;
  width: 64px;
  height: 90px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #090507;
  cursor: grab;
  user-select: none;
  flex: 0 0 auto;
}
.seat-area.opponent .hand-zone .card-mini { width: 32px; height: 45px; cursor: default; }
.card-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  pointer-events: none;
}
.card-mini:hover { outline: 2px solid var(--accent2); z-index: 20; }
.field-card {
  position: absolute;
  transform: translate(-50%, -50%);
}
.field-card.tapped { transform: translate(-50%, -50%) rotate(90deg); }
.card-mini.tapped:not(.field-card) { transform: rotate(90deg); }
.card-hp, .card-counter {
  position: absolute;
  z-index: 3;
  border-radius: 7px;
  box-shadow: 0 0 5px #000;
  font-weight: 900;
  color: #fff;
}
.card-hp {
  right: -6px;
  top: -7px;
  background: #b3122b;
  border: 1px solid #ff8a9c;
  font-size: .68rem;
  padding: 1px 5px;
}
.card-counter {
  left: -5px;
  bottom: -5px;
  min-width: 18px;
  text-align: center;
  background: var(--violet);
  font-size: .7rem;
}
.control-rail {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  padding: 1px 0;
}
.control-rail button, .control-rail select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 0.72rem;
}
.control-rail button { cursor: pointer; }
.control-rail button:hover { border-color: var(--accent2); }
.pile-button {
  position: relative;
  width: 50px;
  height: 70px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pile-button img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.pile-count {
  position: absolute;
  right: 2px;
  bottom: 1px;
  background: rgba(0,0,0,.72);
  color: #fff;
  border-radius: 5px;
  padding: 0 4px;
  font-size: .68rem;
  font-weight: 900;
}
.midline {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.drag-ghost {
  position: fixed;
  z-index: 3000;
  width: 64px;
  height: 90px;
  pointer-events: none;
  opacity: .92;
  transform: rotate(-4deg);
  border-radius: 6px;
  box-shadow: 0 14px 30px rgba(0,0,0,.72);
}
.drag-ghost img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }

.online-menu {
  display: none;
  position: fixed;
  z-index: 1700;
  min-width: 174px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 9px;
  padding: 4px;
  box-shadow: 0 14px 38px rgba(0,0,0,.75);
}
.online-menu.open { display: block; }
.online-menu button {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
}
.online-menu button:hover { background: var(--accent); }
.online-menu .sep { height: 1px; background: var(--border); margin: 4px 2px; }

.online-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1600;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.online-modal.open { display: flex; }
.modal-box {
  width: min(920px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
}
.modal-title {
  font-family: var(--display);
  font-weight: 800;
  margin-bottom: 14px;
  padding-right: 70px;
}
.pile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}
.pile-card {
  background: rgba(0,0,0,.22);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
}
.pile-card img { width: 100%; border-radius: 6px; }
.pile-card-name {
  margin: 5px 0;
  font-size: .7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pile-card button {
  width: 100%;
  margin-top: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 4px;
  cursor: pointer;
  font-size: .67rem;
}
.preview-box {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  max-width: min(930px, 95vw);
  max-height: 90vh;
}
.preview-box img {
  max-height: 86vh;
  max-width: 56vw;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
}
.preview-info { max-width: 350px; max-height: 86vh; overflow-y: auto; }
.preview-name {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.preview-tags { color: var(--accent2); font-weight: 700; margin-bottom: 10px; }
.preview-effect {
  white-space: pre-wrap;
  line-height: 1.55;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 9px;
  padding: 12px;
}
.preview-flavor { margin-top: 12px; color: var(--muted); font-style: italic; line-height: 1.45; }
#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #0f070a;
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: 9px;
  padding: 10px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 5000;
}
#toast.show { opacity: 1; }

@media (max-width: 980px) {
  .online-page { overflow: auto; }
  .online-shell { height: auto; min-height: calc(100vh - 61px); }
  .room-view { grid-template-columns: 1fr; height: auto; }
  .room-sidebar { border-right: none; border-bottom: 1px solid var(--border); max-height: none; }
  .online-board { height: 860px; }
  .lobby-head { flex-direction: column; }
  .profile-edit { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .online-page header { align-items: flex-start; padding: 10px 12px; flex-wrap: wrap; }
  .online-page .header-right { width: 100%; margin-left: 0; justify-content: flex-start; }
  .lobby-grid { grid-template-columns: 1fr; }
  .card-mini { width: 54px; height: 76px; }
  .field-card.tapped { transform: translate(-50%, -50%) rotate(90deg); }
  .control-rail { gap: 5px; }
  .control-rail button, .control-rail select { font-size: .68rem; padding: 5px 6px; }
  .preview-box { flex-direction: column; align-items: center; }
  .preview-box img { max-width: 90vw; max-height: 56vh; }
  .preview-info { max-width: 90vw; }
}
