/* ===== 基础 ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  background: linear-gradient(180deg, #0b3d2e 0%, #0a2a21 55%, #07191a 100%);
  color: #e9f5ee;
  min-height: 100vh;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.container { max-width: 560px; margin: 0 auto; padding: 10px 14px 40px; }

/* ===== Header ===== */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: rgba(5,30,23,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.app-header .title { font-size: 17px; font-weight: 600; color: #fff; }
.app-header .subtitle { font-size: 12px; color: #88c8aa; margin-top: 2px; }
.app-header .back {
  background: rgba(255,255,255,.08);
  border: none; color: #d5f1e1;
  padding: 6px 10px; border-radius: 8px; font-size: 14px;
}
.app-header .spacer { width: 50px; }

.game-header .room-info, .game-header .round-info {
  display: flex; align-items: center; gap: 4px; font-size: 12px;
}
.game-header .room-info .room-label { color: #9ec9b4; }
.game-header .room-info .room-num { font-weight: 700; color: #ffcd6b; letter-spacing: 1px; }
.game-header .round-tag { color: #d5f1e1; }
.game-header .round-sep { color: #6ba78c; }
.game-header .role-tag {
  background: linear-gradient(135deg, #f6a93b, #e88317);
  color: #fff;
  border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 700;
}
.role-tag.hidden { display: none; }

/* ===== Card & Fields ===== */
.card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 12px; text-align: center; }

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 13px; color: #a7d7bd; margin-bottom: 6px;
}
.field > label .hint { color: #7aa991; font-weight: 400; }
.field > input, .field > select {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  outline: none;
  transition: border-color .2s;
}
.field > input:focus, .field > select:focus { border-color: #4fb98b; }
.field > input:disabled { background: rgba(255,255,255,.03); color: #9bc4ae; }
.hint { font-size: 12px; color: #84ad97; margin-top: 4px; }

.row-split { display: flex; gap: 8px; align-items: center; }
.row-split input { flex: 1; }

.row-buttons { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, #30c08a, #1e9c6e);
  color: #fff;
}
.btn-secondary {
  background: linear-gradient(135deg, #2e5b7e, #214560);
  color: #dff0ff;
}
.btn-copy {
  background: linear-gradient(135deg, #e8a846, #d97e18);
  color: #fff;
}
.btn-big { width: 100%; padding: 13px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.share-hint {
  background: rgba(255,200,100,.12);
  color: #ffd37e;
  padding: 8px 10px; border-radius: 8px;
  margin-bottom: 12px; font-size: 13px;
  border: 1px solid rgba(255,200,100,.22);
}

/* ===== Room Info ===== */
.room-info { margin-top: 14px; padding-top: 14px; border-top: 1px dashed rgba(255,255,255,.1); }
.info-title { font-size: 13px; color: #8ecbb0; margin-bottom: 8px; font-weight: 600; }
.info-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  font-size: 13px; color: #cfe8db;
}
.info-list { margin-top: 8px; }
.info-item {
  padding: 5px 8px;
  margin-bottom: 4px;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  font-size: 13px;
}
.info-item .seq { color: #81b299; margin-right: 4px; }
.tag-admin {
  display: inline-block;
  background: linear-gradient(135deg, #f6a93b, #e88317);
  color: #fff; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; margin-right: 4px;
}
.tag-me {
  display: inline-block;
  background: #4fb98b;
  color: #fff; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; margin-right: 4px;
}
.share-row { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.copy-tip { color: #88bba2; font-size: 12px; }
.action-hint { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.players-preview { margin-top: 18px; }

/* 非管理员等待提示条 */
.status-tip {
  margin: 14px 0 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(79,185,139,.12);
  border: 1px solid rgba(79,185,139,.35);
  color: #bde6d1;
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

.tips {
  margin-top: 20px;
  font-size: 12px; color: #7ba592; line-height: 1.8;
  padding: 0 6px;
}

/* ===== Zone 通用 ===== */
.zone {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}
.zone-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.zone-label { font-size: 14px; font-weight: 700; color: #fff; }
.zone-sub { font-size: 12px; color: #8dbca5; }

/* ===== 球样式 ===== */
.ball, .ball-mine, .ball-other {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-weight: 700; font-size: 13px;
  margin: 2px;
  border: 1.5px solid rgba(0,0,0,.35);
  box-shadow: inset 0 -3px 6px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.3);
  user-select: none;
  vertical-align: middle;
  position: relative;
  background: #f8f8f8;
  color: #222;
}
.ball::before, .ball-mine::before, .ball-other::before {
  content: "";
  position: absolute;
  top: 15%; left: 25%;
  width: 30%; height: 18%;
  background: rgba(255,255,255,.5);
  border-radius: 50%;
  transform: rotate(-20deg);
}
.ball.active { background: radial-gradient(circle at 30% 25%, #ffffff 0%, #e9e9e9 55%, #c8c8c8 100%); }
.ball-mine.active { background: radial-gradient(circle at 30% 25%, #fff7e0 0%, #f4dfae 55%, #d9b36a 100%); }
.ball.dead, .ball-mine.dead, .ball-other.dead {
  background: #2a2a2a; color: #666;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6);
  opacity: .5;
}
.ball-mine.new, .ball-mine.new-flash {
  animation: flash 1.5s ease-in-out 2;
}
@keyframes flash {
  0%, 100% { box-shadow: inset 0 -3px 6px rgba(0,0,0,.35), 0 0 0 0 rgba(255,200,100,0); }
  50% { box-shadow: inset 0 -3px 6px rgba(0,0,0,.35), 0 0 0 4px rgba(255,200,100,.5); }
}

.ball-row { margin-bottom: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.global-row { justify-content: flex-start; }
.balls-inline { display: inline-flex; flex-wrap: wrap; flex: 1; }
.row-tag {
  width: 58px; flex-shrink: 0;
  font-size: 11px; color: #8dbca5;
  font-weight: 600;
}
.row-time { font-size: 11px; color: #ffd37e; margin-left: auto; padding: 0 4px; }
.row-note { font-size: 11px; color: #7ba592; margin-left: auto; padding: 0 4px; }

/* ===== 数据卡 ===== */
.zone-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.data-card {
  background: rgba(0,0,0,.15);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 10px 12px;
  position: relative;
}
.data-label { font-size: 11px; color: #8fc6ab; }
.data-value {
  font-size: 22px; font-weight: 800;
  color: #fff; margin-top: 2px;
}
.data-card.gold .data-value { color: #ffd47a; }
.data-card.pool .data-value { color: #9edfff; }
.data-card.count .data-value { color: #c7f5b1; }
.data-delta {
  position: absolute; right: 12px; top: 10px;
  font-size: 12px; color: #8fc6ab;
}
.data-delta.up { color: #3ee095; }
.data-delta.down { color: #ff8686; }

.data-card.order .data-value {
  font-size: 13px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  margin-top: 4px;
}
.order-list span {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,.08);
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 12px;
}
.order-list .arrow {
  background: none; padding: 0 2px; color: #6ec298;
}
.order-list .me { background: #2e8063; color: #fff; }
.order-list .out { text-decoration: line-through; opacity: .45; }

/* ===== 操作按钮 ===== */
.zone-actions .btn-row {
  display: flex; gap: 8px; margin-bottom: 8px;
}
.action-btn {
  flex: 1;
  background: linear-gradient(135deg, #2a6f54, #1a4b38);
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
  padding: 12px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  transition: opacity .15s, transform .1s;
}
.action-btn:active { transform: scale(.97); }
.action-btn.disabled { opacity: .45; pointer-events: none; }
.action-btn.admin-only { }
.action-btn.end-btn {
  background: linear-gradient(135deg, #295e7c, #1d455c);
}
.action-btn.btn-admin {
  background: linear-gradient(135deg, #6f5a2a, #5c431a);
}
.action-btn.force-btn {
  background: linear-gradient(135deg, #823131, #651f1f);
}
.action-btn.btn-personal {
  background: linear-gradient(135deg, #6647a0, #483077);
}

.row-admin2 .action-btn { flex: 1; }

/* ===== 状态提示 ===== */
.status-hint {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13px; font-weight: 600;
  background: rgba(48,192,138,.12);
  color: #a9ebcc;
  border: 1px solid rgba(48,192,138,.25);
}
.status-hint .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3ee095;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{ transform: scale(1); opacity: 1;} 50%{ transform: scale(1.5); opacity: .55;} }
.status-hint.status-S2 { background: rgba(255,188,62,.14); color: #ffcf7e; border-color: rgba(255,188,62,.35); }
.status-hint.status-S2 .dot { background: #ffbe3e; }
.status-hint.status-S3 { background: rgba(255,108,108,.14); color: #ffadad; border-color: rgba(255,108,108,.35); }
.status-hint.status-S3 .dot { background: #ff6c6c; }
.status-hint.status-S4 { background: rgba(110,160,255,.14); color: #bad4ff; border-color: rgba(110,160,255,.35); }
.status-hint.status-S4 .dot { background: #6ea0ff; }
.status-hint.status-S5 { background: rgba(160,110,255,.14); color: #d5bcff; border-color: rgba(160,110,255,.35); }
.status-hint.status-S5 .dot { background: #a06eff; }
.status-hint.status-S6 { background: rgba(255,160,60,.14); color: #ffcc9e; border-color: rgba(255,160,60,.35); }
.status-hint.status-S6 .dot { background: #ffa03c; }

/* ===== 滚动消息 ===== */
.scroll-news {
  background: rgba(0,0,0,.25);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.05);
}
.news-item {
  font-size: 12px;
  color: #cfe8db;
  padding: 3px 0;
  line-height: 1.55;
  border-bottom: 1px dashed rgba(255,255,255,.06);
}
.news-item:last-child { border-bottom: none; }
.news-item .time { color: #7aa991; margin-right: 6px; font-size: 11px; }

/* ===== 邀请链接 ===== */
.invite-zone .invite-label { font-size: 12px; color: #8fc6ab; margin-bottom: 6px; }
.invite-row { display: flex; gap: 8px; }
.invite-row input {
  flex: 1;
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 8px 10px;
  color: #fff; font-size: 12px;
}

/* ===== 弹窗 ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal-panel {
  position: relative;
  background: #0d2c23;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  padding: 18px;
  width: 100%; max-width: 420px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.modal-title { font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.modal-desc { font-size: 13px; color: #a9d3be; margin-bottom: 14px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-btn {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  font-weight: 700;
  border: none;
}
.modal-btn.cancel { background: rgba(255,255,255,.08); color: #d5f1e1; }
.modal-btn.confirm { background: linear-gradient(135deg, #30c08a, #1e9c6e); color: #fff; }

.balls-select {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px 0;
}
.ball.select-ball { cursor: pointer; transition: transform .1s; }
.ball.select-ball.selected {
  outline: 3px solid #3ee095;
  outline-offset: 2px;
  transform: scale(1.08);
}

.foul-types { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.foul-radio {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.04);
  border-radius: 8px; padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
}
.foul-radio input { accent-color: #3ee095; }

/* ===== 结算 ===== */
.result-aux {
  background: rgba(0,0,0,.2);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,.06);
}
.aux-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  font-size: 13px; color: #cfe8db;
}
.aux-row span:last-child { color: #ffd37e; font-weight: 600; }

.result-table-wrap { overflow-x: auto; margin-bottom: 10px; }
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 500px;
}
.result-table th, .result-table td {
  padding: 9px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,.07);
  white-space: nowrap;
}
.result-table th:first-child, .result-table td:first-child { text-align: left; }
.result-table th {
  color: #8ecbb0;
  font-weight: 600;
  font-size: 12px;
  background: rgba(255,255,255,.03);
  position: sticky; top: 0;
}
.result-table td.final { color: #ffd37e; font-weight: 700; }
.up { color: #3ee095 !important; }
.down { color: #ff8686 !important; }
.win { color: #3ee095 !important; font-weight: 700; }
.lose { color: #ff8686 !important; font-weight: 700; }

.verify-line {
  font-size: 12px; color: #8ecbb0;
  text-align: center; margin: 10px 0 14px;
}
.verify-line.verify-err { color: #ffadad; }

/* ===== 响应式 ===== */
@media (max-width: 360px) {
  .ball, .ball-mine, .ball-other { width: 27px; height: 27px; font-size: 12px; }
  .data-value { font-size: 19px; }
}
