﻿/* css/game_app.css */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Noto Sans TC", "Segoe UI", "Microsoft JhengHei", sans-serif;
}

body {
  background: #f7f4ed;
  color: #111827;
}

.game-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-app[data-phase="night"] {
  background: #000030;
  color: #f8fafc;
}

.game-app[data-phase="day"] {
  background: floralwhite;
  color: #111827;
}

.game-app[data-phase="beforegame"] {
  background: seashell;
  color: #111827;
}

.game-app[data-phase="aftergame"] {
  background: aliceblue;
  color: #111827;
}

.game-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.game-app[data-phase="night"] .game-topbar {
  background: rgba(0, 0, 48, 0.76);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.room-title {
  font-weight: 800;
  font-size: 16px;
}

.room-sub {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.75;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mini-btn {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.game-main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 10px 10px 92px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.section-note {
  font-size: 12px;
  opacity: 0.7;
}

.player-panel,
.status-panel,
.talk-panel {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  padding: 10px;
  margin-bottom: 10px;
}

.game-app[data-phase="night"] .player-panel,
.game-app[data-phase="night"] .status-panel,
.game-app[data-phase="night"] .talk-panel {
  background: rgba(15, 23, 42, 0.62);
  border-color: rgba(255, 255, 255, 0.12);
}

.player-panel.is-pinned {
  position: sticky;
  top: 58px;
  z-index: 15;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.player-card {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.game-app[data-phase="night"] .player-card {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(255, 255, 255, 0.13);
}

.player-card.is-self {
  outline: 2px solid rgba(59, 130, 246, 0.55);
}

.player-card.is-dead {
  background: #555;
  color: #f8fafc;
}

.player-card.is-voted .player-meta::after {
  content: " ✓";
  font-weight: 900;
}

.player-card.is-marked {
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.65);
}

.player-avatar-wrap {
  flex: 0 0 48px;
  height: 48px;
  display: grid;
  place-items: center;
}

.player-avatar {
  object-fit: contain;
  border: 2px solid;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
}

.player-info {
  min-width: 0;
}

.player-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
}

.player-meta {
  margin-top: 3px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  opacity: 0.78;
}

.system-hint {
  font-size: 13px;
  font-weight: 700;
}

.talk-log {
  max-height: calc(100vh - 310px);
  min-height: 360px;
  overflow: auto;
  padding: 4px;
}

.talk-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 7px 0;
}

.talk-row.is-self {
  flex-direction: row-reverse;
}

.talk-avatar-wrap {
  width: 48px;
  min-width: 48px;
  display: grid;
  place-items: start center;
}

.talk-avatar {
  object-fit: contain;
  border: 2px solid;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
}

.talk-bubble {
  max-width: min(760px, calc(100% - 56px));
  border-radius: 15px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.game-app[data-phase="night"] .talk-bubble {
  background: rgba(30, 41, 59, 0.86);
  border-color: rgba(255, 255, 255, 0.1);
}

.talk-head {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 2px;
  font-size: 12px;
  opacity: 0.88;
}

.talk-name {
  font-weight: 900;
}

.talk-time {
  font-size: 11px;
  opacity: 0.7;
}

.talk-body {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.talk-body.font-strong {
  font-size: 18px;
  font-weight: 900;
}

.talk-body.font-weak {
  font-size: 12px;
  opacity: 0.82;
}

.talk-input-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 8px 10px env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.82);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(18px);
}

.game-app[data-phase="night"] .talk-input-bar {
  background: rgba(0, 0, 48, 0.86);
  border-top-color: rgba(255, 255, 255, 0.14);
}

.talk-form {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

#sayInput {
  width: 100%;
  resize: none;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  padding: 9px 10px;
  font: inherit;
}

.talk-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#fontType,
.send-btn {
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  padding: 0 10px;
  font-weight: 800;
}

.send-btn {
  background: #2563eb;
  color: white;
  cursor: pointer;
}

@media (max-width: 620px) {
  .game-main {
    padding-left: 6px;
    padding-right: 6px;
  }

  .player-grid {
    gap: 4px;
  }

  .player-card,
  .game-app.compact-players .player-card {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 5px 2px;
    min-height: 76px;
  }

  .player-avatar-wrap {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .player-avatar {
    max-width: 32px;
    max-height: 32px;
  }

  .player-name {
    width: 100%;
    text-align: center;
    font-size: 11px;
    line-height: 1.15;
    max-height: 2.3em;
    overflow: hidden;
  }

  .player-meta,
  .game-app.compact-players .player-meta {
    display: none;
  }

  .talk-log {
    max-height: calc(100vh - 280px);
    min-height: 300px;
  }

  .talk-form {
    grid-template-columns: 1fr;
  }

  .talk-tools {
    flex-direction: row;
  }

  #fontType {
    flex: 1;
  }

  .send-btn {
    min-width: 88px;
  }
}
.login-box {
  width: min(1120px, 100%);
  margin: 8px auto 0;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(0,0,0,.1);
}

.login-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
}

.login-form input {
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.16);
  padding: 0 8px;
}

.login-form button,
.register-link {
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  border: 0;
  background: #2563eb;
  color: white;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.register-link {
  margin-left: 6px;
  background: #64748b;
}