/* css/announce.css — the in-game announcements (docs/team/ingame-announcements-20261123.md sections 2 and 9).
   The one top slot (js/online/topslot.js): a member whose turn it is not waits hidden under ts-wait (the update banner of
   js/online/update.js sets it after its 250 ms rewrite of its class; the server notice bar of js/online/servers.js toggles
   it). The slot's top is --ts-top on the root, measured once a second under the HUD's top pieces; a strip in the slot sits
   no higher than its own top within the safe area. */
.ts-wait { display: none !important; }
#megaticker { top: max(calc(env(safe-area-inset-top, 0px) + 64px), var(--ts-top, 0px)); }
/* --ts-side: on a touch screen the chat, mail and bell buttons stand in a column at the top left; the strip keeps clear of
   it with equal margins on both sides, so it stays centred (js/online/topslot.js measures it; html raises this over the
   megaticker's own style) */
html #megaticker, #ann-banner { width: min(760px, calc(100vw - 2 * max(16px, var(--ts-side, 0px)))); }
@media (max-width: 767px) {
  #megaticker { top: max(calc(env(safe-area-inset-top, 0px) + 52px), var(--ts-top, 0px)); }
}

/* The staff look (section 2.1; the values are docs/team/ingame-announcements-20261123/look.json, which the page's tests
   compare against): a white fill, dark ink, a 2 px border and a solid badge block at the left in the level's colour,
   holding an inline shield and the word "ประกาศ" / "Notice" in white. No navy and no gold: those are the paid looks
   (the megaticker's own style: a navy bar with a gold rim). The staff ticker (#megaticker.mt-staff, js/online/megaticker.js)
   and the sticky banner (#ann-banner, js/online/annstrip.js) share it. */
#megaticker.lv-normal, #ann-banner.lv-normal, dialog.ann-pop.lv-normal, .ann-row.lv-normal { --ann-badge: #185776; }
#megaticker.lv-event, #ann-banner.lv-event, dialog.ann-pop.lv-event, .ann-row.lv-event { --ann-badge: #185776; }
#megaticker.lv-warning, #ann-banner.lv-warning, dialog.ann-pop.lv-warning, .ann-row.lv-warning { --ann-badge: #b35300; }
#megaticker.lv-urgent, #ann-banner.lv-urgent, dialog.ann-pop.lv-urgent, .ann-row.lv-urgent { --ann-badge: #c8213a; }
#megaticker.mt-staff {
  background: #10283b;
  border: 2px solid var(--ann-badge);
  padding: 0 10px 0 0;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
#megaticker.mt-staff .mt-run { color: #e8f7ff; text-shadow: none; }
#megaticker.mt-staff .mt-badge,
#ann-banner .ab-badge,
dialog.ann-pop .ap-badge,
.ann-row .ar-badge {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  align-self: stretch;
  padding: 0 8px;
  background: var(--ann-badge);
  color: #e8f7ff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
#megaticker.mt-staff .mt-badge svg,
#ann-banner .ab-badge svg,
dialog.ann-pop .ap-badge svg,
.ann-row .ar-badge svg { width: 14px; height: 14px; flex: none; }

/* The sticky banner (section 2.4): a strip in the top slot, one line cut with an ellipsis (the whole text stays in the
   page); a tap on its text opens it to at most three lines, a second tap folds it. Its ✕ (or "รับทราบ" / "Got it" under
   "until acknowledged") closes it. Where the megaticker sits: centred, at most 760 px wide, under the HUD's top pieces. */
/* (under every window layer: the old windows' .kw-panel 30, the square windows' #sq 45, the K windows 9150. The banner is
   the one strip that takes taps, and it stays up for days: an open window over it takes its own taps. Over the field and
   the HUD's own layer, which sits under the strip anyway) */
#ann-banner {
  position: fixed;
  left: 50%;
  top: max(calc(env(safe-area-inset-top, 0px) + 64px), var(--ts-top, 0px));
  transform: translateX(-50%);
  z-index: 29;
  min-height: 38px;
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  background: #10283b;
  color: #e8f7ff;
  border: 2px solid var(--ann-badge);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  font-family: 'Noto Sans Thai', 'Baloo 2', sans-serif;
}
#ann-banner[hidden] { display: none; }
#ann-banner .ab-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  text-align: start;
  cursor: pointer;
  overflow: hidden;
}
/* (the words sit in a span inside the button, which is the clamp box: a button with display -webkit-box becomes flow-root,
   so WebKit never clamped its lines and Chromium showed the top of a fourth line in its padding; the padding stays on the
   button, outside the clipped span) */
#ann-banner .ab-words {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#ann-banner.open .ab-text { padding: 6px 10px; }
#ann-banner.open .ab-words {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
}
#ann-banner .ab-text:focus-visible,
#ann-banner .ab-x:focus-visible { outline: 2px solid var(--ann-badge); outline-offset: -4px; }
#ann-banner .ab-x {
  flex: none;
  min-width: 34px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-left: 1px solid rgba(21, 34, 59, .15);
  background: transparent;
  color: #e8f7ff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
#ann-banner .ab-x.ack { background: var(--ann-badge); color: #e8f7ff; font-size: 13px; }
/* (a tap is a tap: no double-tap zoom on a quick open and fold, no browser flash over the white strip, as the game's own
   buttons, css/style.css and css/mobile.css) */
#ann-banner button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (max-width: 767px) {
  #ann-banner { top: max(calc(env(safe-area-inset-top, 0px) + 52px), var(--ts-top, 0px)); min-height: 32px; }
  #ann-banner .ab-text { font-size: 13px; }
  #megaticker.mt-staff .mt-badge,
  #ann-banner .ab-badge { padding: 0 6px; font-size: 12px; }
}
/* (touch: the close keeps a 32 px target, the badge words stay) */
@media (pointer: coarse) {
  #ann-banner .ab-x { min-width: 40px; }
}

/* The centre pop-up (section 2.5, js/online/annpop.js): a non-modal <dialog> opened with show(), so the HUD around it
   stays live. The staff look: a white card, dark ink, a 2 px border and the badge in the level's colour. A PC: at most
   440 px, centred. On a phone annpop.js sets top, bottom, left, right, width and max-height from what it measures (clear
   of the thumb buttons); the rules here are the fallback. The body scrolls inside the card. */
dialog.ann-pop {
  position: fixed;
  inset: 16px;
  z-index: 9160;
  width: min(440px, calc(100vw - 32px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  box-sizing: border-box;
  background: #10283b;
  color: #e8f7ff;
  border: 2px solid var(--ann-badge);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-family: 'Noto Sans Thai', 'Baloo 2', sans-serif;
  overflow: hidden;
}
dialog.ann-pop[open] { display: flex; flex-direction: column; }
dialog.ann-pop:focus { outline: none; }
dialog.ann-pop .ap-head { display: flex; align-items: stretch; flex: none; min-height: 40px; border-bottom: 1px solid rgba(21, 34, 59, .15); }
dialog.ann-pop .ap-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
dialog.ann-pop .ap-x {
  flex: none;
  min-width: 40px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-left: 1px solid rgba(21, 34, 59, .15);
  background: transparent;
  color: #e8f7ff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
dialog.ann-pop .ap-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px; }
dialog.ann-pop .ap-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin: 0 0 10px;
  background: #10283b;
}
dialog.ann-pop .ap-text { margin: 0 0 8px; font-size: 14px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
dialog.ann-pop .ap-body { margin: 0; font-size: 13px; line-height: 1.5; color: #e8f7ff; white-space: pre-line; overflow-wrap: anywhere; }
dialog.ann-pop .ap-btns {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(21, 34, 59, .15);
}
dialog.ann-pop .ap-btn,
dialog.ann-pop .ap-ack {
  min-height: 30px;
  margin: 0;
  padding: 0 14px;
  border: 2px solid var(--ann-badge);
  background: #10283b;
  color: #e8f7ff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
dialog.ann-pop .ap-ack { background: var(--ann-badge); color: #e8f7ff; }
/* (a tap is a tap: no double-tap zoom, no browser flash over the white card) */
dialog.ann-pop button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) {
  dialog.ann-pop .ap-x:hover { background: #10283b; }
  dialog.ann-pop .ap-btn:hover { background: #10283b; background: color-mix(in srgb, var(--ann-badge) 10%, #10283b); }
  dialog.ann-pop .ap-ack:hover { background: color-mix(in srgb, var(--ann-badge) 82%, #081b2b); }
}
dialog.ann-pop .ap-x:focus-visible,
dialog.ann-pop .ap-btn:focus-visible,
dialog.ann-pop .ap-ack:focus-visible { outline: 2px solid var(--ann-badge); outline-offset: 2px; }
dialog.ann-pop .ap-x:focus-visible { outline-offset: -4px; }
@media (pointer: coarse) {
  dialog.ann-pop .ap-x { min-width: 44px; }
  dialog.ann-pop .ap-btn,
  dialog.ann-pop .ap-ack { min-height: 40px; }
}

/* The news board's rows (section 2.6; tools/proto/proto_s2_knews.js annFill, drawn in the phone's K window and the PC's
   square window, js/sq/news.js): the staff look as a card in the reading pane, the level's badge and the title on one line,
   the picture, the text, the body with its line breaks, the buttons, and "ถึง <Bangkok time>". Every rule is under
   .ann-row, so the K window's own `.k9n-art p` gives way. */
.ann-rows { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0 0 4px; }
.ann-row {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
  padding: 0 0 8px;
  background: #10283b;
  color: #e8f7ff;
  border: 2px solid var(--ann-badge);
  font-family: 'Noto Sans Thai', 'Baloo 2', sans-serif;
  overflow-wrap: anywhere;
  text-align: start;
}
.ann-row .ar-head { display: flex; align-items: stretch; min-height: 28px; border-bottom: 1px solid rgba(21, 34, 59, .15); }
.ann-row .ar-badge { font-size: 12px; }
.ann-row .ar-title { flex: 1; min-width: 0; margin: 0; padding: 4px 10px; align-self: center; font-size: 14px; font-weight: 800; line-height: 1.35; color: #e8f7ff; }
.ann-row .ar-img { display: block; width: calc(100% - 20px); height: auto; aspect-ratio: 16 / 9; margin: 2px 10px 0; object-fit: cover; background: #10283b; }
.ann-row .ar-text { margin: 0 10px; font-size: 13px; font-weight: 600; line-height: 1.45; color: #e8f7ff; }
.ann-row .ar-body { margin: 0 10px; font-size: 12.5px; font-weight: 500; line-height: 1.5; color: #e8f7ff; white-space: pre-line; }
.ann-row .ar-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 10px 0; }
.ann-row .ar-btn {
  min-height: 30px;
  margin: 0;
  padding: 0 12px;
  border: 2px solid var(--ann-badge);
  background: #10283b;
  color: #e8f7ff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.ann-row .ar-btn:hover { background: #10283b; }
.ann-row .ar-btn:focus-visible { outline: 2px solid var(--ann-badge); outline-offset: 2px; }
.ann-row .ar-until { margin: 0 10px; font-size: 11.5px; font-weight: 600; line-height: 1.3; color: #a7c5d9; }
/* (touch: the 44 px a finger needs, as every button of the touch HUD, css/sq-touch.css) */
@media (pointer: coarse) {
  .ann-row .ar-btn { min-height: 44px; }
}
/* the phone's K window: the red dot on its ทั้งหมด and ประกาศ tabs while a notice is unread (the tab is position: relative) */
.k9n-tdot {
  position: absolute;
  right: 6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ea2f3c;
  box-shadow: 0 0 0 2px #416e87;
  pointer-events: none;
}
