.net-dialog {
  width: min(570px, calc(100vw - 28px));
  max-height: 88svh;
  padding: 0;
  color: #eee3cd;
  background: #1b211e;
  border: 1px solid #a88b55;
  box-shadow: 0 20px 80px #000b;
  overflow: auto;
}
.net-dialog::backdrop {
  background: #080c0bb8;
}
.net-dialog header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #1b211e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #705f41;
}
.net-dialog h2,
.net-dialog h3 {
  font-family: var(--serif, serif);
  margin: 0;
}
.net-dialog h2 {
  font-size: 24px;
}
.net-dialog h3 {
  font-size: 18px;
  color: #e4c88d;
  margin: 17px 0 8px;
}
.net-body {
  padding: 0 20px 20px;
}
.net-copy,
.net-notice {
  font-size: 14px;
  line-height: 1.7;
}
.net-notice {
  position: sticky;
  bottom: 0;
  background: #293329;
  padding: 10px 20px;
  margin: 0;
  color: #f2d398;
}
.net-row,
.net-send,
.net-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.net-row {
  padding: 8px 0;
  border-bottom: 1px solid #9b804d35;
  flex-wrap: wrap;
  font-size: 14px;
}
.net-row > span {
  margin-right: auto;
}
.net-tabs {
  flex-wrap: wrap;
  padding: 12px 0 4px;
}
.net-button,
.net-primary,
.net-dialog select,
.net-dialog input:not([type="checkbox"]) {
  border: 1px solid #776949;
  background: #292e28;
  color: #f2e9d9;
  padding: 8px 10px;
  font: inherit;
  border-radius: 2px;
}
.net-button,
.net-primary {
  cursor: pointer;
  font-size: 13px;
}
.net-button[aria-pressed="true"],
.net-primary {
  background: #b89a63;
  color: #211d16;
  border-color: #d5b980;
}
.net-dialog button:disabled {
  opacity: 0.47;
  cursor: default;
}
.net-dialog button:hover:enabled {
  filter: brightness(1.15);
}
.net-form {
  display: grid;
  gap: 10px;
}
.net-label {
  display: grid;
  gap: 4px;
  color: #d3c8b1;
  font-size: 13px;
}
.net-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.net-chat {
  max-height: 155px;
  min-height: 56px;
  overflow: auto;
  background: #141a16;
  border: 1px solid #85714c66;
  padding: 6px 10px;
}
.net-chat p {
  font-size: 13px;
  margin: 5px 0;
  overflow-wrap: anywhere;
}
.net-chat b {
  color: #dbbb7c;
}
.net-send {
  margin: 8px 0;
}
.net-send input {
  min-width: 0;
  flex: 1;
}
.net-row input {
  max-width: 45vw;
}
@media (max-width: 460px) {
  .net-body {
    padding: 0 12px 12px;
  }
  .net-dialog header {
    padding: 12px;
  }
  .net-tabs {
    gap: 4px;
  }
  .net-button {
    padding: 7px;
  }
  .net-row {
    gap: 4px;
  }
}
.net-toast {
  position: fixed;
  z-index: 10;
  right: 18px;
  bottom: 53px;
  padding: 9px 14px;
  background: #382e1b;
  color: #f4db9e;
  border: 1px solid #bca76e;
  cursor: pointer;
}
/* In battle the bottom corners hold the supply chest and skill buttons, so the
   notice moves under the top bar and shrinks. */
body:has(#battle:not([hidden])) .net-toast {
  top: 64px;
  right: 50%;
  bottom: auto;
  transform: translateX(50%);
  padding: 5px 10px;
  font-size: 12px;
  opacity: 0.92;
}
/* Server-wide news: slides in under the top bar, stays five seconds, never
   takes a tap. Lower in battle, where the top holds the timer and boss bar. */
.world-news {
  position: fixed;
  inset: auto; /* shown as a popover, which would otherwise centre it */
  margin: 0;
  width: max-content;
  z-index: 40;
  top: 62px;
  left: 50%;
  --news-line: #e8c878;
  --news-text: #ffe9ad;
  --news-glow: #d99a2b;
  --news-mid: #2a1c09;
  box-sizing: border-box;
  min-width: min(340px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 7px 44px 9px;
  overflow: hidden;
  transform: translateX(-50%);
  /* A ribbon that fades out at both ends, ruled above and below in gold. */
  background: linear-gradient(90deg, transparent, #0f0b06f0 16%, var(--news-mid) 50%, #0f0b06f0 84%, transparent);
  border: solid transparent;
  border-width: 1px 0;
  border-image: linear-gradient(90deg, transparent, var(--news-line) 22%, #fff6d8 50%, var(--news-line) 78%, transparent) 1;
  color: var(--news-text);
  font: 700 15px/1.45 var(--serif, serif);
  letter-spacing: 0.08em;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 1px 2px #000, 0 0 10px var(--news-glow);
  pointer-events: none;
  animation: world-news 5.2s ease both;
}
.world-news::before {
  content: "✦ 全服快報 ✦";
  display: block;
  margin-bottom: 1px;
  color: var(--news-line);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-shadow: none;
  opacity: 0.85;
}
/* One sweep of light across the ribbon as it arrives. */
.world-news::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 42%, #fff5d040 50%, transparent 58%);
  background-size: 300% 100%;
  animation: world-news-sweep 1.5s 0.35s ease-out both;
}
.world-loss {
  --news-line: #c26a58;
  --news-text: #f6c4b4;
  --news-glow: #a8321f;
  --news-mid: #2a0f0b;
}
.world-loss::before {
  content: "✦ 全服噩耗 ✦";
}
.world-rank {
  --news-line: #dfe6ee;
  --news-text: #ffffff;
  --news-glow: #8fb4d8;
  --news-mid: #18202b;
}
body:has(#battle:not([hidden])) .world-news {
  top: calc(max(14px, env(safe-area-inset-top)) + 196px);
  padding-block: 5px 6px;
  font-size: 13px;
}
@keyframes world-news {
  0% { opacity: 0; transform: translateX(-50%) scaleX(0.6); letter-spacing: 0.3em; }
  8%, 90% { opacity: 1; transform: translateX(-50%); letter-spacing: 0.08em; }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}
@keyframes world-news-sweep {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .world-news::after { animation: none; background: none; }
}

.net-label[hidden] {
  display: none;
}
.net-fold {
  display: block;
  margin: 10px 0 2px;
  padding: 6px 10px;
  background: transparent;
  border: 1px dashed #8d7a4a;
  color: #e9d7a6;
  font-size: 13px;
}
/* 裝備分數排行榜 */
.net-row.net-self {
  background: #3a4a3a66;
}
.net-row.net-top1 > span {
  color: #ffd36a;
  font-weight: bold;
}
.net-row.net-top2 > span {
  color: #e2e6ec;
  font-weight: bold;
}
.net-row.net-top3 > span {
  color: #e0a173;
  font-weight: bold;
}
.net-gear-list {
  margin: 0 0 6px;
  padding-left: 12px;
  color: #d9c9a3;
}
