/* 自习室样式 */
.back-link {
  color: #2f6fd6;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 12px;
  border-radius: 999px;
}

/* 入场 */
.lobby {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}
.room-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 8px 26px rgba(47, 111, 214, 0.16);
}
.room-emoji { font-size: 40px; }
.room-card h2 { font-size: 18px; color: #2f6fd6; margin: 6px 0; }
.room-tip { font-size: 13px; color: #8a94a6; line-height: 1.7; margin-bottom: 16px; }
.room-card input {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #dbe7f5;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 16px;
  text-align: center;
  outline: none;
  margin-bottom: 12px;
}
.room-card input:focus { border-color: #4a9eff; }
.lobby-row { display: flex; gap: 8px; }
.big-btn { border: none; border-radius: 999px; padding: 12px 0; font-size: 15px; font-weight: 800; cursor: pointer; flex: 1; }
.big-btn { background: linear-gradient(135deg, #3ecf8e, #1fa866); color: #fff; }
.big-btn.secondary { background: linear-gradient(135deg, #4a9eff, #2f6fd6); }
.big-btn:disabled { opacity: 0.6; }
.or { color: #b6c2d6; margin: 10px 0; font-size: 13px; }
.lobby-err { margin-top: 12px; color: #b91c1c; font-size: 13px; background: #fee2e2; border-radius: 10px; padding: 8px; }
.lobby-err[hidden] { display: none; }
.lobby-err.ok { color: #15803d; background: #e7f9ee; }

/* 房间主界面 */
.room-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  gap: 8px;
}
.room-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 999px;
  padding: 6px 8px 6px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.room-code b { color: #2f6fd6; letter-spacing: 3px; font-size: 17px; margin-left: 6px; }
.role { font-size: 12px; color: #15803d; background: #e7f9ee; padding: 3px 10px; border-radius: 999px; }
.role.member { color: #6b7280; background: #f3f4f6; }
.room-tools { margin-left: auto; display: flex; gap: 6px; }
.tool-btn {
  border: none;
  background: #eef2f7;
  color: #334155;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tool-btn.live { background: #ef4444; color: #fff; }
.tool-btn:disabled { opacity: 0.5; }
.tool-btn.share { background: linear-gradient(135deg, #4a9eff, #2f6fd6); color: #fff; }

/* 九宫格 */
.grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  align-content: stretch;
}
.grid.single { grid-template-columns: 1fr; }
.tile {
  position: relative;
  background: #1f2937;
  border-radius: 14px;
  overflow: hidden;
  min-height: 0;
  cursor: pointer;
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.tile.local video { transform: scaleX(-1); }
.tile .ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  font-size: 42px;
}
.tile .nm {
  position: absolute;
  left: 8px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile .mic {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 15px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}
.tile .mic.off { background: rgba(239, 68, 68, 0.85); border-radius: 999px; padding: 2px 6px; }
.tile .adm { position: absolute; top: 6px; left: 8px; background: rgba(245, 158, 11, 0.9); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.tile .mute-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}
.tile .speaking { box-shadow: inset 0 0 0 3px #3ecf8e; }

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (orientation: landscape) and (min-width: 700px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* 🐸 抢食对战 */
.eat-open {
  position: fixed; left: 12px; bottom: 46px; z-index: 30;
  border: none; border-radius: 999px; padding: 10px 16px; cursor: pointer;
  background: linear-gradient(135deg, #34d399, #059669); color: #fff;
  font-size: 14px; font-weight: 800; box-shadow: 0 6px 16px rgba(5,150,105,.35);
}
.eat-overlay {
  position: fixed; inset: 0; z-index: 220; background: rgba(15,23,42,.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.eat-card {
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 20px; padding: 14px;
}
.eat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 16px; color: #065f46; }
.eat-tip { font-size: 13px; color: #6b7280; margin: 6px 0; }
.eat-lv {
  display: flex; justify-content: space-between; width: 100%; box-sizing: border-box;
  border: 1px solid #dbe7f5; background: #f8fbff; color: #1e293b; font-size: 14px; font-weight: 700;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer;
}
.eat-lv span { color: #8a94a6; font-weight: 500; }
.eat-title { font-size: 15px; font-weight: 800; color: #065f46; text-align: center; }
.eat-me { text-align: center; font-size: 14px; color: #334155; margin: 4px 0 8px; }
.eat-pool2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.eat-fish {
  border: none; border-radius: 14px; padding: 10px 6px; cursor: pointer;
  background: linear-gradient(160deg, #e0f2fe, #bae6fd);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 800; color: #0c4a6e;
  box-shadow: 0 3px 10px rgba(14,116,144,.15);
}
.eat-fish:active { transform: scale(.96); }
.eat-board { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0 4px; font-size: 13px; color: #475569; }
.eat-board span { background: #f1f5f9; border-radius: 999px; padding: 4px 10px; }
.eat-board span.me { background: #fef3c7; color: #92400e; font-weight: 800; }
.eat-board.rank { flex-direction: column; align-items: flex-start; }
.eat-win { text-align: center; font-size: 18px; font-weight: 900; color: #d97706; margin: 6px 0; }
.eat-lose { text-align: center; font-size: 14px; color: #64748b; margin: 6px 0; }
