/* 登录 / 大厅 / 房间界面 */

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.screen[hidden] {
  display: none !important;
}

.screen-game {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  min-height: 0;
}

.screen-game .app {
  width: 100%;
  height: 100%;
}

/* —— 登录 / 大厅 / 房间：参考 calm-breeze —— */
.screen-auth,
.screen-lobby,
.screen-room {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* calm-breeze 青绿渐变，略压暗以贴合牌局气质 */
  background: linear-gradient(160deg, #2a6b6a 0%, #3cb88a 48%, #53e3a6 100%);
  color: #fff;
  font-weight: 300;
}

.screen-auth::before,
.screen-lobby::before,
.screen-room::before {
  content: none;
}

/* 漂浮方块气泡（参考 calm-breeze bg-bubbles） */
.auth-bubbles {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  pointer-events: none;
}

.auth-bubbles li {
  position: absolute;
  display: block;
  list-style: none;
  width: 40px;
  height: 40px;
  bottom: -160px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  animation: auth-bubble-rise 25s infinite linear;
}

.auth-bubbles li:nth-child(1) { left: 10%; }
.auth-bubbles li:nth-child(2) {
  left: 20%;
  width: 80px;
  height: 80px;
  animation-delay: 2s;
  animation-duration: 17s;
}
.auth-bubbles li:nth-child(3) {
  left: 25%;
  animation-delay: 4s;
}
.auth-bubbles li:nth-child(4) {
  left: 40%;
  width: 60px;
  height: 60px;
  animation-duration: 22s;
  background: rgba(255, 255, 255, 0.22);
}
.auth-bubbles li:nth-child(5) { left: 70%; }
.auth-bubbles li:nth-child(6) {
  left: 80%;
  width: 110px;
  height: 110px;
  animation-delay: 3s;
  background: rgba(255, 255, 255, 0.18);
}
.auth-bubbles li:nth-child(7) {
  left: 32%;
  width: 140px;
  height: 140px;
  animation-delay: 7s;
}
.auth-bubbles li:nth-child(8) {
  left: 55%;
  width: 20px;
  height: 20px;
  animation-delay: 15s;
  animation-duration: 40s;
}
.auth-bubbles li:nth-child(9) {
  left: 25%;
  width: 12px;
  height: 12px;
  animation-delay: 2s;
  animation-duration: 40s;
  background: rgba(255, 255, 255, 0.28);
}
.auth-bubbles li:nth-child(10) {
  left: 88%;
  width: 150px;
  height: 150px;
  animation-delay: 11s;
}

@keyframes auth-bubble-rise {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-110vh) rotate(600deg); }
}

/* 居中表单区（无外形遮罩） */
.auth-panel,
.lobby-panel,
.room-panel {
  position: relative;
  z-index: 2;
  width: min(360px, 92vw);
  max-width: 100%;
  padding: 28px 12px 20px;
  text-align: center;
  animation: auth-card-in 0.5s ease-out;
}

.room-panel {
  width: min(400px, 94vw);
}

.screen-auth.is-register .auth-panel {
  padding-top: 20px;
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-brand {
  text-align: center;
  margin-bottom: 14px;
}

.auth-panel h1,
.lobby-panel h1,
.room-panel h1 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.6s ease;
}

.auth-sub {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 300;
}

.screen-auth.is-register .auth-sub {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel {
  width: min(440px, 100%);
  background: rgba(12, 16, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.panel-head h1 {
  margin: 0;
  font-size: 1.75rem;
  letter-spacing: 0.04em;
}

.lobby-avatar-host {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.lobby-avatar-host .avatar {
  width: 32px;
  height: 32px;
}

.lobby-avatar-host .avatar-letter {
  font-size: 0.95rem;
}

.account-panel label {
  display: block;
  margin: 12px 0;
  font-size: 0.9rem;
  color: #d2c8b6;
}

.account-panel input[type='text'],
.account-panel input:not([type='file']) {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #f3efe6;
  font: inherit;
}

.account-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.account-username {
  font-weight: 700;
}

.account-created {
  font-size: 0.82rem;
  color: #cfc5b4;
  margin-top: 4px;
}

.career-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.career-chip {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
}

.career-label {
  display: block;
  font-size: 0.78rem;
  color: #cfc5b4;
  margin-bottom: 4px;
}

.record-list,
.achieve-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.record-list li,
.achieve-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.achieve-list li {
  flex-direction: column;
  align-items: flex-start;
}

.achieve-list li.locked {
  opacity: 0.55;
}

.achieve-list em {
  font-style: normal;
  font-size: 0.8rem;
  color: var(--gold, #c9a227);
}

.record-meta,
.account-empty {
  color: #cfc5b4;
  font-size: 0.85rem;
}

.gallery-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-item-wrap {
  position: relative;
}

.gallery-del {
  position: absolute;
  right: 6px;
  top: 6px;
  appearance: none;
  border: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffb4a8;
  font: inherit;
  font-size: 0.75rem;
  padding: 2px 6px;
  cursor: pointer;
}

.screen-auth .tabs {
  display: flex;
  gap: 0;
  margin: 0 auto 14px;
  max-width: 220px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.screen-auth .tab {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  padding: 7px 8px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  transition: background 0.2s ease, color 0.2s ease;
}

.screen-auth .tab:hover {
  color: #fff;
}

.screen-auth .tab.active {
  background: rgba(255, 255, 255, 0.95);
  color: #2f9a7a;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* 大厅等仍用通用 tab */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #d9d0c0;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.tab.active {
  background: #2f7d4e;
  border-color: #3d9a62;
  color: #fff;
}

#form-auth label,
#form-auth .auth-field {
  display: block;
  margin: 0 auto 10px;
  font-size: inherit;
  color: inherit;
  letter-spacing: 0;
  max-width: 250px;
}

/* 必须盖过 display，否则登录页昵称仍会露出来 */
#form-auth label[hidden],
#form-auth .avatar-picker[hidden] {
  display: none !important;
}

#form-auth input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 250px;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 300;
  text-align: center;
  outline: none;
  transition: background 0.25s ease, width 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

#form-auth input::placeholder {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 300;
}

#form-auth input:hover {
  background: rgba(255, 255, 255, 0.35);
}

#form-auth input:focus {
  background: #fff;
  color: #2f9a7a;
  width: min(300px, 100%);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* 大厅输入：与登录框一致 */
.screen-lobby .lobby-join-field {
  display: block;
  margin: 0 auto 10px;
  max-width: 250px;
  width: 100%;
}

.screen-lobby #join-password {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 250px;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 300;
  text-align: center;
  outline: none;
  transition: background 0.25s ease, width 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.screen-lobby #join-password::placeholder {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 300;
}

.screen-lobby #join-password:hover {
  background: rgba(255, 255, 255, 0.35);
}

.screen-lobby #join-password:focus {
  background: #fff;
  color: #2f9a7a;
  width: min(300px, 100%);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* 房间等待页等仍可能用 join-box */
.join-box input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.32);
  color: #f3efe6;
  font: inherit;
  font-size: 0.92rem;
  outline: none;
}

.join-box input::placeholder {
  color: #7a7468;
}

.join-box input:focus {
  border-color: rgba(232, 184, 74, 0.55);
  background: rgba(0, 0, 0, 0.38);
  box-shadow: 0 0 0 3px rgba(232, 184, 74, 0.16);
}

.form-error {
  color: #fff0e8;
  font-size: 0.8rem;
  margin: 4px auto 8px;
  max-width: 250px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(140, 40, 40, 0.35);
  border: 1px solid rgba(255, 200, 180, 0.35);
  text-align: center;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  width: 100%;
}

.btn-auth-main {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 250px;
  margin: 0;
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  background: #fff;
  color: #2f9a7a;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.15s ease;
}

.btn-auth-main:hover {
  background: #f5f7f9;
}

.btn-auth-local {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.45);
  border-radius: 0;
  padding: 0 0 1px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 300;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.btn-auth-local:hover {
  color: #fff;
  border-bottom-color: #fff;
}

/* 大厅次要按钮：描边白 */
.btn-breeze-outline {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 250px;
  margin: 0 auto;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.15s ease;
}

.btn-breeze-outline:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: #fff;
}

.lobby-user {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 18px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 1rem;
  font-weight: 300;
}

.lobby-username {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-lobby .lobby-avatar-host .avatar {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.screen-lobby .lobby-avatar-host .avatar-letter {
  font-size: 1.05rem;
  background: linear-gradient(145deg, #3cb88a 0%, #2a6b6a 100%);
}

.lobby-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 18px;
}

.screen-lobby .lobby-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.screen-lobby .lobby-actions .btn-auth-main {
  margin: 0 auto;
}

.screen-lobby .form-error {
  margin-top: 10px;
}

.btn-block {
  width: 100%;
  margin-top: 8px;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 1.05rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #2a241c;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  vertical-align: middle;
}

.avatar-lg {
  width: 80px;
  height: 80px;
  border: 2px solid rgba(232, 184, 74, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.avatar-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #f7f1e4;
  background: linear-gradient(145deg, #3d5a80 0%, #1b2838 100%);
  line-height: 1;
  user-select: none;
}

.avatar.avatar-letter {
  object-fit: unset;
}

.avatar-picker {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0 0 10px;
  padding: 0;
  background: transparent;
  border: none;
}

.avatar-hit-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}

.avatar-hit {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 64px;
  height: 64px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.7),
    0 6px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.avatar-hit:hover {
  transform: scale(1.04);
  box-shadow:
    0 0 0 2px #fff,
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.avatar-hit .avatar {
  width: 100%;
  height: 100%;
  border: none;
  box-shadow: none;
  border-radius: 50%;
}

.avatar-hit .avatar-letter {
  font-size: 1.55rem;
}

.avatar-clear {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #2f9a7a;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.avatar-clear:hover {
  background: #fff;
  color: #c04040;
}

#avatar-picker #auth-avatar-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0 !important;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.seat-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.score-chip .avatar {
  width: 36px;
  height: 36px;
}

.player-head {
  align-items: center;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.join-box {
  display: flex;
  gap: 8px;
}

.join-box input {
  margin: 0;
  flex: 1;
}

/* 大厅已改为竖排 breeze 布局，保留 join-box 供其它页使用 */

.room-code-box {
  text-align: center;
  padding: 14px 12px 16px;
  margin: 4px auto 14px;
  max-width: 280px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
}

.room-code-box .label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 300;
}

.room-code-box .code {
  font-size: 1.85rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  color: #fff;
  margin: 8px 0 12px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.screen-room .room-code-box .btn-breeze-outline {
  max-width: 160px;
  padding: 8px 14px;
  font-size: 0.92rem;
}

.seat-list {
  list-style: none;
  margin: 0 auto 12px;
  padding: 0;
  display: grid;
  gap: 8px;
  max-width: 300px;
  text-align: left;
}

.seat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 300;
}

.seat-list li.empty {
  opacity: 0.55;
  color: rgba(255, 255, 255, 0.8);
}

.seat-list .tag {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 400;
}

.screen-room .seat-list .avatar {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.screen-room .seat-list .avatar-letter {
  font-size: 0.85rem;
  background: linear-gradient(145deg, #3cb88a 0%, #2a6b6a 100%);
}

.room-tip {
  text-align: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.88rem;
  font-weight: 300;
  margin: 0 0 8px;
}

.room-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.screen-room .room-actions .btn-auth-main:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.7);
  color: #2f9a7a;
}

.meta-chip {
  font-size: 0.85rem;
  color: #f0e2b8;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 10px;
  border-radius: 8px;
}

.player-row.me {
  border-color: rgba(61, 154, 98, 0.7);
}

.offline-mark {
  color: #ffb4a8;
  font-size: 0.8rem;
  margin-left: 6px;
}

@media (orientation: landscape) and (max-height: 560px) {
  .screen {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 8px 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .screen-auth,
  .screen-lobby,
  .screen-room {
    overflow: auto;
  }

  .auth-panel,
  .lobby-panel,
  .room-panel {
    width: min(320px, 86vw);
    padding: 12px 8px 10px;
  }

  .auth-panel h1,
  .lobby-panel h1,
  .room-panel h1,
  .panel-head h1 {
    font-size: 1.35rem;
  }

  .auth-brand {
    margin-bottom: 8px;
  }

  .avatar-hit-wrap,
  .avatar-hit {
    width: 48px;
    height: 48px;
  }

  .auth-bubbles {
    display: none;
  }

  .lobby-user {
    margin-bottom: 12px;
  }

  .lobby-footer {
    margin-top: 12px;
  }

  .room-code-box .code {
    font-size: 1.45rem;
    letter-spacing: 0.2em;
  }

  .seat-list {
    max-width: 100%;
    gap: 6px;
  }

  .seat-list li {
    padding: 8px 10px;
  }

  .panel {
    width: min(520px, 100%);
    max-height: calc(100dvh - 16px);
    overflow: auto;
    padding: 16px 18px;
  }
}
