/* Event window, event list and mailbox (GAME_SPEC §4.21, mockups 2026-11-02). Layout here; colours, borders
   and shadows are plain properties the UI layer tool can adjust (docs/web-ui-style.md §6). */
.popup-card--events,
.popup-card--event-list,
.popup-card--mail {
  max-width: 440px;
  max-height: calc(100vh - 32px - var(--popup-safe-y));
  max-height: calc(100dvh - 32px - var(--popup-safe-y));
  gap: 8px;
}

.popup-events-heading {
  margin: 0;
}

/* ---------- banner ---------- */
.event-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #f0c27a;
  box-shadow: 0 3px 0 rgba(150, 90, 30, 0.25);
  flex: 0 0 auto;
}

.event-banner-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-banner-title {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 6%;
  padding: 4px 10px;
  border-radius: 12px;
  background: #ffb02e;
  border: 2px solid #c96a12;
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
  line-height: 1.15;
  box-shadow: 0 3px 0 rgba(120, 60, 0, 0.35);
}

.event-banner-next {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #2f7ee6;
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(0, 40, 110, 0.35);
}

.event-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  min-height: 8px;
}

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e2d3bd;
}

.event-dot.active {
  background: #f5a623;
}

.event-period,
.event-body {
  margin: 0;
  text-align: center;
  color: #5a3b1d;
}

.event-period {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.event-period-chip {
  padding: 1px 8px;
  border-radius: 10px;
  background: #8a5a2b;
  color: #ffffff;
  font-size: 0.72rem;
}

.event-body {
  font-size: 0.95rem;
  font-weight: 700;
}

/* ---------- mission + gift boxes ---------- */
.event-mission,
.event-gift {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #fffaf1;
  border: 2px solid #f0dcb8;
}

.event-mission {
  flex-wrap: wrap;
}

.event-mission-icon,
.event-gift-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
}

.event-mission-main {
  flex: 1 1 120px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.event-mission-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: #4d3420;
}

.event-bar {
  position: relative;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #e9dcc7;
}

.event-bar-fill {
  height: 100%;
  border-radius: 8px;
  background: #57c22b;
}

.event-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.event-rewards,
.mail-row-rewards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.event-chip,
.mail-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px 2px 3px;
  border-radius: 12px;
  background: #fff2d9;
  border: 1px solid #efd4a6;
  font-size: 0.76rem;
  font-weight: 800;
  color: #4d3420;
  white-space: nowrap;
}

.event-chip-icon,
.mail-chip-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.event-mission-claim {
  flex: 1 0 100%;
}

.event-gift-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #4d3420;
}

.event-gift-open {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.event-skip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #6b4b2a;
  cursor: pointer;
}

.event-skip input {
  width: 18px;
  height: 18px;
}

/* ---------- list ---------- */
.mail-list {
  min-height: 0;
  flex: 1 1 auto;
  margin: 0;
  padding: 2px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  text-align: left;
}

.mail-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 14px;
  background: #ffffff;
  border: 2px solid #f0dcb8;
  box-shadow: 0 2px 0 rgba(150, 105, 50, 0.15);
}


.mail-empty {
  margin: 12px 0;
  text-align: center;
  color: #8a6a48;
}

/* ---------- mailbox ---------- */
.mail-note {
  margin: 0;
  font-size: 0.78rem;
  color: #8a6a48;
  text-align: center;
}

.mail-row {
  grid-template-columns: 52px minmax(0, 1fr) auto;
}

.mail-row[data-state="claimed"] {
  background: #f4efe7;
  opacity: 0.8;
}

.mail-row[data-state="claimed"] .mail-row-claim {
  filter: grayscale(1);
}

.mail-row-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.mail-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mail-row-title {
  font-size: 0.92rem;
  font-weight: 900;
  color: #3f2a14;
}

.mail-row-sender,
.mail-row-body {
  font-size: 0.74rem;
  color: #7a5a38;
}

.mail-row-claim {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.options-mail {
  position: relative;
}

.options-mail .notification-badge--count {
  top: -6px;
  right: -4px;
}

.resource-bar-settings {
  position: relative;
}

.resource-bar-settings .notification-badge--alert {
  top: -4px;
  right: -4px;
}

/* ---------- events screen (World layout) ---------- */
#screen-events .event-card {
  position: relative;
}

.event-card-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 10px;
  border-radius: 10px;
  background: #ffcf3a;
  border: 2px solid #c98a12;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
  box-shadow: 0 2px 0 rgba(120, 70, 0, 0.35);
}

.event-card[data-ready="true"] .event-card-tag {
  background: #57c22b;
  border-color: #2f7d12;
}

/* ---------- attendance bonus stamps + reward lines (event popup) ---------- */
.event-bonus {
  flex-direction: column;
  align-items: stretch;
}

/* Share event (2026-11-10): the same box and stamps as the attendance bonus, a note and the share button. */
.event-share-stamps {
  justify-content: center;
  gap: 14px;
}

.event-share-note {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #6b4b2a;
  text-align: center;
}

.event-share-button {
  align-self: center;
  min-width: 70%;
}

.event-bonus-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 800;
  color: #4d3420;
}

.event-bonus-stamps {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.event-bonus-stamp {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px dashed #d8c3a2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.event-bonus-stamp[data-got="true"] {
  border: 2px solid #f0b429;
  background: #fff3cf;
}

.event-bonus-stamp-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.event-extras {
  margin: 0;
  padding: 6px 10px;
  list-style: none;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.event-extra {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 800;
  color: #4d3420;
}

.event-extra-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

/* Event cards carry a period and a short line: the copy may use most of the card (the CTA sits bottom-right). */
#screen-events .event-card .world-card-copy {
  flex: 1 1 100%;
}

#screen-events .event-card .world-card-title {
  font-size: clamp(19px, 5.4vw, 28px);
}

#screen-events .event-card .world-card-cta {
  margin-left: auto;
}

#screen-events .event-card .world-card-desc {
  white-space: normal;
}

/* Settings popup: the mailbox beside the manual (one row), so a 320px screen keeps the language list. */
.options-bottom-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.options-bottom-row > .btn {
  flex: 1 1 0;
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
  font-size: clamp(14px, 4.2vw, 18px);
}

/* Account deletion (GAME_SPEC §4.23, js/accountDelete.js): a small quiet button at the foot of Options and a text-only popup. */
.options-account-delete,
.options-block-clear {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font-size: clamp(13px, 3.8vw, 16px);
  white-space: normal;
}

.popup-card--account-delete {
  max-width: 360px;
  gap: 10px;
  max-height: calc(100vh - 40px - var(--popup-safe-y));
  max-height: calc(100dvh - 40px - var(--popup-safe-y));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.account-delete-body-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-delete-body,
.account-delete-warn-text,
.account-delete-status {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.38;
  color: #4d3420;
  text-align: start;
}

.account-delete-status {
  text-align: center;
}

.account-delete-warn {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid #e0a63a;
  border-radius: 12px;
  background: #fff3d6;
}

.account-delete-warn .btn {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 1rem;
}

.account-delete-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-delete-actions .btn {
  min-height: 52px;
  min-width: 0;
  padding: 8px 12px;
  font-size: 1.1rem;
}

.account-delete-actions .btn[data-ui-style="account-delete-danger"] {
  background: linear-gradient(180deg, #ff7a6b 0%, #d6342a 55%, #a31c14 100%);
  border: 2px solid #6e120c;
}

.account-delete-actions .btn:disabled,
.popup-card--account-delete .popup-close-btn:disabled {
  opacity: 0.55;
}
