/* The event page's frame (event-layout.js) and the tournament chat (event-chat.js). Uses style.css's
   tokens; kept apart from style.css so it could ship while style.css held other unreleased work. */

/* Header: name, status line, two buttons and the More menu */
.page-head.event-head { align-items: flex-start; margin-bottom: 18px; }
.event-title { min-width: 0; }
.event-title h1 { overflow-wrap: anywhere; }
.page-head .event-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 17px; margin-top: 10px; }
.event-sub .badge { font-size: 13px; }
.event-sub .badge.draft { background: #e8e8ed; }

.menu { position: relative; }
.menu-button { display: inline-flex; align-items: center; gap: 6px; }
.menu-chevron { font-size: 12px; line-height: 1; }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 230px; padding: 6px; background: rgba(255, 255, 255, .97); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 14px; box-shadow: var(--sh-lg), 0 0 0 1px var(--hairline); display: grid; }
.menu-item { font: inherit; font-size: 16px; text-align: left; color: var(--ink); background: none; border: 0; border-radius: 8px; padding: 9px 12px; cursor: pointer; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--brand); color: #fff; outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--danger); color: #fff; }
.menu-divider { border: 0; border-top: 1px solid var(--hairline); margin: 5px 8px; }

/* Tabs: stay under the global nav while the page scrolls */
.event-tabs { position: sticky; top: 64px; z-index: 15; display: flex; gap: 4px; margin: 0 calc(var(--gutter) * -1) 24px; padding: 8px var(--gutter); background: rgba(245, 245, 247, .88); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hairline); overflow-x: auto; scrollbar-width: none; }
.event-tabs::-webkit-scrollbar { display: none; }
.event-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 980px; font-size: 16px; font-weight: 500; color: rgba(0, 0, 0, .78); white-space: nowrap; text-decoration: none !important; }
.event-tab:hover { background: rgba(0, 0, 0, .05); color: #000; }
.event-tab.active { background: var(--ink); color: #fff; font-weight: 600; }
.tab-count { font-size: 14px; font-weight: 400; color: var(--gray-600); font-variant-numeric: tabular-nums; }
.event-tab.active .tab-count { color: rgba(255, 255, 255, .7); }
.tab-alert, .tile-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--live); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.tile-badge { display: inline-block; margin-right: 8px; vertical-align: 2px; }

.event-body > .panel:last-child, .event-body > :last-child .panel:last-child { margin-bottom: 0; }

/* Overview: tiles that open their tab, then the venue and the details */
.overview-block { margin-bottom: 22px; }
.overview-heading { font-size: 21px; margin: 0 0 12px; }
.overview-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.overview-tile { position: relative; display: grid; align-content: start; gap: 3px; min-height: 104px; padding: 16px 34px 16px 18px; background: var(--surface); border: 0; border-radius: var(--r-lg); color: var(--ink); text-align: left; font: inherit; cursor: pointer; text-decoration: none !important; transition: box-shadow .2s, transform .2s; }
.overview-tile:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }
.overview-tile.alert { box-shadow: inset 0 0 0 2px var(--brand); }
.overview-tile.alert:hover { box-shadow: inset 0 0 0 2px var(--brand), var(--sh-md); }
.tile-top { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--gray-600); }
.tile-step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--gray-300); color: var(--gray-600); }
.overview-tile.done .tile-step { background: var(--green); box-shadow: none; color: #fff; }
.overview-tile.alert .tile-step { background: var(--brand); box-shadow: none; color: #fff; }
.tile-value { font-size: 19px; font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.tile-note { font-size: 14px; color: var(--gray-600); }
.tile-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--gray-400); }
.overview-grid { align-items: start; }
.overview-grid .panel-head { margin-bottom: 14px; }
.venue-name { margin-top: 10px; }
.notes { white-space: pre-wrap; }

/* The venue plan: a click shows it big */
.plan-button { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 14px; }
.plan-button svg { display: block; width: 100%; height: auto; border-radius: 14px; }
.plan-zoom-hint { position: absolute; right: 10px; bottom: 10px; padding: 4px 10px; border-radius: 980px; background: rgba(29, 29, 31, .72); color: #fff; font-size: 13px; font-weight: 600; opacity: 0; transition: opacity .15s; pointer-events: none; }
.plan-button:hover .plan-zoom-hint, .plan-button:focus-visible .plan-zoom-hint { opacity: 1; }
dialog:has(.plan-zoom) { width: min(1180px, calc(100vw - 32px)); }
.plan-zoom-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 8px; }
.plan-zoom-head h2 { margin: 0; }
.plan-levels { margin: 0; }
.plan-stage { display: grid; place-items: center; }
.plan-stage svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 230px); border-radius: 14px; }

/* Two columns: the main thing and what goes with it */
.event-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.event-split > .panel, .event-side > .panel:last-child { margin-bottom: 0; }
.event-side { display: grid; gap: 20px; }
.event-side > .panel { margin: 0; }
.event-split + * { margin-top: 20px; }

/* The tournament chat */
.chat .panel-head { margin-bottom: 2px; }
.chat-intro { margin: 0 0 14px; }
.chat-log { height: clamp(340px, calc(100vh - 430px), 680px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px; background: var(--paper); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 2px; }
.chat-log:focus-visible { outline-offset: -2px; }
.chat-empty { margin: auto; text-align: center; max-width: 380px; font-size: 16px; }
.chat-earlier { align-self: center; margin: 2px 0 10px; }
.chat-day { align-self: center; margin: 12px 0 6px; padding: 3px 12px; border-radius: 980px; background: rgba(0, 0, 0, .05); font-size: 13px; font-weight: 600; color: var(--gray-600); }
.chat-group { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; max-width: 100%; }
.chat-group.mine { flex-direction: row-reverse; }
.chat-face { flex: none; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; margin-bottom: 2px; }
span.chat-face { cursor: default; }
.chat-stack { display: grid; gap: 2px; min-width: 0; max-width: min(620px, 82%); }
.chat-group.mine .chat-stack { justify-items: end; }
.chat-author { margin: 0 0 1px 12px; font-size: 13px; color: var(--gray-600); }
.chat-author strong { color: var(--ink); font-weight: 600; }
.chat-role { margin-left: 6px; padding: 1px 7px; border-radius: 980px; background: var(--accent); color: var(--navy); font-size: 11px; font-weight: 700; letter-spacing: .01em; vertical-align: 1px; }
.chat-bubbles { display: grid; gap: 2px; justify-items: start; }
.chat-group.mine .chat-bubbles { justify-items: end; }
.chat-line { display: flex; align-items: center; gap: 4px; max-width: 100%; }
.chat-group.mine .chat-line { flex-direction: row-reverse; }
.chat-bubble { min-width: 0; padding: 8px 13px 6px; border-radius: 18px; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); user-select: text; }
.chat-group.mine .chat-bubble { background: var(--brand); color: #fff; }
.chat-text { margin: 0; font-size: 16px; line-height: 1.38; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-group.mine .chat-text a { color: #fff; text-decoration: underline; }
.chat-meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 1px; font-size: 11px; color: var(--gray-400); }
.chat-group.mine .chat-meta { color: rgba(255, 255, 255, .75); }
.chat-likes { color: var(--live); font-weight: 700; }
.chat-group.mine .chat-likes { color: #fff; }
.chat-tools { display: flex; gap: 0; visibility: hidden; }
.chat-line:hover .chat-tools, .chat-line:focus-within .chat-tools { visibility: visible; }
.chat-bubble:focus-visible { outline-offset: 1px; }
.chat-tools .mini { width: 28px; height: 28px; padding: 0; font-size: 15px; color: var(--gray-600); }
.chat-tools .mini[aria-pressed=true] { color: var(--live); }
.chat-tools .mini.danger:hover { color: var(--danger); }
.chat-footer { margin-top: 12px; }
.chat-compose { display: flex; align-items: flex-end; gap: 10px; }
.chat-input { flex: 1; min-height: 44px; max-height: 180px; resize: none; border-radius: 22px; padding: 10px 16px; line-height: 1.4; }
.chat-send { flex: none; height: 44px; }
.chat-hint { display: flex; justify-content: space-between; gap: 12px; margin: 6px 4px 0; }
.chat-note { margin: 0; padding: 12px 16px; border-radius: var(--r-md); background: var(--paper); }
.chat-closed .button-row { margin-top: 14px; }
/* An announcement between the messages: across the whole chat in the accent colour, with the megaphone. */
.chat-announcement { align-self: stretch; margin: 12px 0 6px; padding: 10px 14px 12px; border-radius: var(--r-md); background: rgba(215, 255, 58, .3); border: 1px solid var(--accent-dark); color: var(--navy); }
.chat-announcement-head { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 13px; }
.chat-announcement-head svg { flex: none; width: 17px; height: 17px; }
.chat-announcement-head strong { font-weight: 700; }
.chat-announcement-head time { margin-left: auto; padding-left: 8px; font-size: 12px; color: var(--gray-600); font-variant-numeric: tabular-nums; }
.chat-announcement .chat-text { font-weight: 600; }

@media (max-width: 1000px) {
  .event-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .event-tabs { top: 0; margin-bottom: 18px; }
  .page-head.event-head .actions { width: 100%; gap: 8px; }
  .page-head.event-head .actions .button { font-size: 15px; padding: 7px 14px; }
  .chat-stack { max-width: 88%; }
  .chat-log { height: clamp(320px, 62vh, 600px); }
}
@media (max-width: 560px) {
  .overview-tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .overview-tile { min-height: 96px; padding: 14px 26px 14px 14px; }
  .tile-value { font-size: 17px; }
  .tile-go { right: 10px; }
  .menu-list { right: auto; left: 0; }
}
