/* ════════════════════════════════════════════════════════════════════════════
   PORTAL — page-specific layout only.
   The house style (tokens, panels, buttons, pills, fields, the rune-edge motif)
   now lives in foundry-ui.css. This file holds only what is unique to the
   portal: page layout, the hub frame's internals, tabs, and per-tab content.
   ════════════════════════════════════════════════════════════════════════════ */

/* Center the screens; .af-page (on <body>) supplies the backdrop + base type. */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px;
}

/* ── Narrow auth card — layout on top of .af-panel ─────────────────────────── */
.card {
  padding: 36px 36px 32px;
  width: 100%;
  max-width: 390px;
  margin-top: auto;
  margin-bottom: auto;
}

/* ── Wide hub card — layout on top of .af-panel ────────────────────────────── */
.hub-card {
  width: 100%;
  max-width: 1100px;
  height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hub-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--border);
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity .15s ease;
}
.hub-brand:hover { opacity: 0.82; }
.hub-anvil {
  display: block;
  width: 22px;
  aspect-ratio: 654 / 624;
  flex-shrink: 0;
  background: linear-gradient(160deg, #c4b5fd 0%, #a78bfa 40%, #f5a35a 80%, #d97706 100%);
  -webkit-mask: url('/images/anvil-updated-white.png') center / contain no-repeat;
          mask: url('/images/anvil-updated-white.png') center / contain no-repeat;
}
.hub-wordmark {
  display: block;
  width: 200px;
  aspect-ratio: 2115 / 171;
  background: linear-gradient(90deg, #c4b5fd 0%, #a78bfa 35%, #f5a35a 75%, #d97706 100%);
  -webkit-mask: url('/images/arkaenite-foundry-logo-white.png') center / contain no-repeat;
          mask: url('/images/arkaenite-foundry-logo-white.png') center / contain no-repeat;
}

.hub-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 28px 20px;
  border-bottom: 1px solid var(--border);
}

/* Wrap the avatar to isolate drop-shadow from clip-path */
.hub-avatar-wrap {
  flex-shrink: 0;
  filter: drop-shadow(0 0 7px rgba(217,119,6,0.4));
}

.hub-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124,58,237,0.45) 0%, rgba(217,119,6,0.3) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 700;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: #ffd9a8;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.hub-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hub-profile-info { flex: 1; min-width: 0; }

.hub-name {
  font-size: 19px;
  font-weight: 700;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: #ffd9a8;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-active-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  color: var(--amber2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
  opacity: 0.85;
}

.hub-meta {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: var(--text3);
  margin-top: 3px;
  letter-spacing: 0.04em;
}

/* ── Tab navigation ───────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  overflow: visible;
  scrollbar-width: none;
  gap: 4px;
  position: relative;
}
.tab-nav::-webkit-scrollbar { display: none; }

/* Arcane divider rails flanking the centered tabs:
   a hairline that fades out toward the edge, capped by a glowing diamond
   where it meets the tabs. */
.tab-rail {
  flex: 1 1 0;
  max-width: 200px;
  height: 1px;
  align-self: center;
  position: relative;
}
.rail-left  { margin-right: 18px; background: linear-gradient(90deg, transparent 0%, rgba(124,58,237,0.30) 65%, var(--amber) 100%); }
.rail-right { margin-left: 18px;  background: linear-gradient(90deg, var(--amber) 0%, rgba(124,58,237,0.30) 35%, transparent 100%); }
.tab-rail::before {
  content: '';
  position: absolute;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translateY(-50%) rotate(45deg);
  background: var(--amber-lit);
  box-shadow: 0 0 7px rgba(217,119,6,0.65);
}
.rail-left::before  { right: -3px; }
.rail-right::before { left: -3px; }

.tab-btn {
  background: none;
  border: none;
  border-top: 2px solid transparent;
  color: var(--text3);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  padding: 14px 16px 13px;
  cursor: pointer;
  margin-bottom: 0;
  transition: color 180ms ease, background 180ms ease;
  white-space: nowrap;
  position: relative;
}
.tab-btn:hover { color: var(--text2); }
.tab-btn.active {
  color: #ffe2b3;
  text-shadow: 0 0 14px rgba(217,119,6,0.45);
  /* Lit panel glowing up from the underline, with the card's chamfered top corners */
  background: linear-gradient(180deg,
    rgba(124,58,237,0.04)  0%,
    rgba(124,58,237,0.10) 45%,
    rgba(217,119,6,0.16) 100%);
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%, 0 7px);
}

/* Sliding indicator — absolutely positioned inside .tab-nav.
   Tapered rune-line that fades at both ends, glowing, with a diamond node
   centered on it to match the side rails. */
.tab-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--amber) 22%,
    var(--amber-lit) 50%,
    var(--amber) 78%,
    transparent 100%);
  box-shadow: 0 0 8px rgba(217,119,6,0.7), 0 0 16px rgba(124,58,237,0.4);
  pointer-events: none;
  will-change: transform, width;
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1),
              width    220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-indicator::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 6px;
  height: 6px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--amber-lit);
  box-shadow: 0 0 8px rgba(251,191,36,0.9);
}

.tab-badge {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  margin-left: 5px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.tab-content {
  padding: 30px 36px 36px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.tab-content::-webkit-scrollbar { width: 4px; }
.tab-content::-webkit-scrollbar-track { background: transparent; }
.tab-content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.tab-content::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,0.6); }
/* Firefox */
.tab-content { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }

/* ── Entry rows (history / messages / notifications) ──────────────────────────
   The surface + rune-edge motif comes from .af-entry (foundry-ui.css). These
   markers stay here for state and per-row layout:
     .af-entry            interactive row (hover lights the rune-edge)
     .af-entry.is-static  non-interactive row (notifications without an issue)
     .af-entry.is-active  "marked"/unread row (rune-edge lit permanently)        */

/* ── Notification items ───────────────────────────────────────────────────── */

.notif-item { cursor: default; padding: 12px 16px 13px; }
.notif-item.notif-clickable { cursor: pointer; }
.notif-ticket-id {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  color: var(--text3);
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.notif-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.notif-type {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(124,58,237,0.18);
  color: var(--text2);
}
.notif-type-resolved     { background: rgba(40,200,122,0.15); color: var(--success); }
.notif-type-commented    { background: rgba(124,58,237,0.18); color: #a78bfa; }
.notif-type-state_changed,
.notif-type-stage_changed { background: rgba(217,119,6,0.15); color: var(--amber2); }
.notif-date  { font-size: 12px; color: var(--text3); margin-left: auto; }
.notif-issue { font-size: 14px; color: var(--text); font-weight: 500; }
.notif-detail { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* ── Message items ────────────────────────────────────────────────────────── */

.messages-list { display: flex; flex-direction: column; gap: 12px; }
.msg-item { cursor: pointer; padding: 14px 16px 14px; }
.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}
.msg-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.msg-type {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--amber2);
  white-space: nowrap;
}
.msg-meta { font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.msg-body { font-size: 14px; color: var(--text2); line-height: 1.6; white-space: pre-wrap; }

/* ── Overview tab ─────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* Surface + rune-edge seal come from .af-seal; --rune-inset tightens the line. */
.stat-card {
  --rune-inset: 14px;
  padding: 15px 10px 15px;
  text-align: center;
}

/* Label goes above value — feels like an instrument readout */
.stat-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--amber2);
  opacity: 0.7;
  margin-bottom: 7px;
}

.stat-value {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: #ffd9a8;
  line-height: 1;
}

.overview-loading {
  font-size: 13px;
  color: var(--text3);
  text-align: center;
  padding: 20px 0;
}

/* ── History tab ──────────────────────────────────────────────────────────── */
.history-empty {
  text-align: center;
  color: var(--text3);
  font-size: 14px;
  padding: 32px 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 13px;
}

.history-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-date {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Redeem tab ───────────────────────────────────────────────────────────── */
.redeem-intro {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 20px;
  line-height: 1.5;
}

.success-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
}

.success-icon { margin-bottom: 14px; }

.success-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--success);
  text-align: center;
  margin-bottom: 4px;
}

.success-code {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: var(--text3);
  text-align: center;
  margin-bottom: 22px;
  letter-spacing: 0.06em;
}

/* ── Shared auth card styles ──────────────────────────────────────────────── */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  gap: 10px;
}

.brand-icon {
  display: block;
  width: 54px;
  aspect-ratio: 654 / 624;
  background: linear-gradient(160deg, #c4b5fd 0%, #a78bfa 40%, #f5a35a 80%, #d97706 100%);
  -webkit-mask: url('/images/anvil-updated-white.png') center / contain no-repeat;
          mask: url('/images/anvil-updated-white.png') center / contain no-repeat;
  filter: drop-shadow(0 0 16px rgba(124,58,237,0.4)) drop-shadow(0 0 8px rgba(217,119,6,0.25));
}

.brand-wordmark {
  display: block;
  width: min(260px, 80%);
  aspect-ratio: 2115 / 171;
  background: linear-gradient(90deg, #c4b5fd 0%, #a78bfa 35%, #f5a35a 75%, #d97706 100%);
  -webkit-mask: url('/images/arkaenite-foundry-logo-white.png') center / contain no-repeat;
          mask: url('/images/arkaenite-foundry-logo-white.png') center / contain no-repeat;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  font-family: 'Cormorant Garamond', Georgia, serif;
  letter-spacing: 0.06em;
  color: #ffd9a8;
  margin-bottom: 5px;
  text-shadow: 0 0 20px rgba(217,119,6,0.25);
}

.subtitle {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 24px;
  line-height: 1.5;
}

label {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 5px;
}

/* Fields use .af-input / .af-textarea; the redeem code field overrides type. */
input#codeInput {
  text-transform: uppercase;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 11px 12px;
}

.field { margin-bottom: 16px; }

/* Form submit buttons (.af-btn.af-btn--block) sit just below their field. */
.af-btn--block { margin-top: 4px; }

.link-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.back-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  cursor: pointer;
  width: fit-content;
}
.back-row:hover .back-label { color: var(--text2); }
.back-arrow {
  color: var(--text3);
  font-size: 18px;
  line-height: 1;
  transition: color .15s;
}
.back-label {
  font-size: 13px;
  color: var(--text3);
  transition: color .15s;
}

#status {
  font-size: 13px;
  margin-top: 13px;
  text-align: center;
  line-height: 1.5;
  min-height: 18px;
}
.status-ok   { color: var(--success); }
.status-err  { color: var(--danger); }
.status-info { color: var(--text3); }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Embers ───────────────────────────────────────────────────────────────── */
/* Embers (.embers/.ember) and section headers (.af-section*) live in foundry-ui.css. */

.issues-empty {
  font-size: 13px;
  color: var(--text3);
  padding: 14px 0;
  text-align: center;
}

.issue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

/* Chamfered state badges — clip-path makes them feel designed */
.issue-state {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.state-resolved {
  background: rgba(40,200,122,0.1);
  color: #28c87a;
  border: 1px solid rgba(40,200,122,0.28);
}

.state-active {
  background: rgba(217,119,6,0.12);
  color: #f5a35a;
  border: 1px solid rgba(217,119,6,0.3);
}

.state-open {
  background: var(--surface2);
  color: var(--text3);
  border: 1px solid var(--border2);
}

.issue-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.issue-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.issue-type,
.issue-id,
.issue-date {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
}

.show-more-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .15s;
}
.show-more-btn:hover { color: var(--text2); }

/* ── Issue view button — styling from .af-btn-ghost.af-chamfer-sm ───────────── */
.issue-view-btn { flex-shrink: 0; }

/* ── Issue detail modal ───────────────────────────────────────────────────── */
.im-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.im-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5,2,10,0.82);
  backdrop-filter: blur(3px);
}

/* Carved frame + glow + top rune-line come from .af-panel.af-panel--focal. */
.im-panel {
  width: 100%;
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.im-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 18px;
  flex-shrink: 0;
}
/* rune-line divider under the header, with a centered diamond node */
.im-header::after {
  content: '';
  position: absolute;
  left: 24px; right: 24px; bottom: 0;
  height: 2px;
  background: var(--rune-line);
  opacity: 0.55;
  box-shadow: 0 0 8px rgba(217,119,6,0.35);
}
.im-header::before {
  content: '';
  position: absolute;
  left: 50%; bottom: -2px;
  width: 6px; height: 6px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--amber-lit);
  box-shadow: 0 0 8px rgba(251,191,36,0.85);
  z-index: 1;
}

.im-id {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: #a78bfa;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.im-title {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: #ffd9a8;
  letter-spacing: 0.03em;
  line-height: 1.35;
}

.im-close {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 0;
  color: var(--text3);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color .15s, color .15s;
  margin-top: 1px;
}
.im-close:hover { border-color: var(--accent); color: var(--text); }

.im-body {
  overflow-y: auto;
  flex: 1;
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.im-body::-webkit-scrollbar { width: 4px; }
.im-body::-webkit-scrollbar-track { background: transparent; }
.im-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.im-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.im-badge {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.im-badge.state-resolved { background: rgba(40,200,122,0.1);  color: #28c87a; border-color: rgba(40,200,122,0.28); }
.im-badge.state-active   { background: rgba(217,119,6,0.12);  color: #f5a35a; border-color: rgba(217,119,6,0.3); }
.im-badge.state-open     { background: var(--surface2);       color: var(--text3); border-color: var(--border2); }
.im-badge.im-type        { background: rgba(124,58,237,0.1);  color: #a78bfa; border-color: rgba(124,58,237,0.25); }
.im-badge.im-meta        { background: var(--surface2);       color: var(--text3); border-color: var(--border2); }

.im-section-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
  margin-bottom: 10px;
}

.im-description {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.im-description.loading { color: var(--text3); font-style: italic; }

.im-steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.im-steps li {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.5;
}

.im-bug-grid { display: flex; flex-direction: column; gap: 8px; }

.im-bug-row { display: flex; gap: 10px; align-items: flex-start; }

.im-bug-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-width: 80px;
  flex-shrink: 0;
  padding-top: 2px;
}

.im-bug-value {
  font-size: 13px;
  color: var(--text2);
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.im-version-pill, .im-platform-pill {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  padding: 1px 7px;
  color: var(--text2);
  white-space: nowrap;
}

/* ── Comments ─────────────────────────────────────────────────────────────── */
.im-comments-loading, .im-comments-empty {
  font-size: 13px;
  color: var(--text3);
  padding: 10px 0;
  text-align: center;
}

.im-comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.im-comment {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.im-comment.player { flex-direction: row-reverse; }

.im-comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Cormorant Garamond', Georgia, serif;
  user-select: none;
}
.im-comment.player .im-comment-avatar {
  background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(217,119,6,0.25));
  border: 1px solid rgba(124,58,237,0.4);
  color: #c4b5fd;
}
.im-comment.team .im-comment-avatar {
  background: linear-gradient(135deg, rgba(217,119,6,0.25), rgba(124,58,237,0.2));
  border: 1px solid rgba(217,119,6,0.35);
  color: #f5a35a;
}

.im-comment-content { flex: 1; min-width: 0; }
.im-comment.player .im-comment-content { text-align: right; }

.im-comment-meta {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.im-comment-bubble {
  display: inline-block;
  max-width: 88%;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  text-align: left;
}
.im-comment.player .im-comment-bubble {
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.22);
  color: var(--text);
}
.im-comment.team .im-comment-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}

/* ── Add comment form ─────────────────────────────────────────────────────── */
.im-comment-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0 16px;
}

/* .im-textarea styling comes from .af-textarea. */

.im-comment-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.im-char-count {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: var(--text3);
}
.im-char-count.warn   { color: #d97706; }
.im-char-count.danger { color: var(--danger); }

/* .im-submit-btn styling comes from .af-btn.af-btn--sm. */

.im-comment-status {
  font-size: 12px;
  margin-top: 6px;
  min-height: 14px;
  text-align: right;
  color: var(--danger);
}

/* ── Entitlements tab ─────────────────────────────────────────────────────── */
.entitlement-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entitlement-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.entitlement-type {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  white-space: nowrap;
}

.type-permanent {
  background: rgba(124,58,237,0.12);
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,0.28);
}

.type-once {
  background: var(--surface2);
  color: var(--text3);
  border: 1px solid var(--border2);
}

.entitlement-claimed {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  white-space: nowrap;
}

.type-claimed {
  background: rgba(40,200,122,0.1);
  color: #28c87a;
  border: 1px solid rgba(40,200,122,0.28);
}

/* ── Info icon + tooltip ──────────────────────────────────────────────────── */
.entitlement-info {
  display: inline-flex;
  align-items: center;
  position: relative;
  color: var(--text3);
  cursor: help;
  margin-left: 5px;
  vertical-align: middle;
  transition: color .15s;
}
.entitlement-info:hover,
.entitlement-info:focus { color: var(--text2); outline: none; }

/* ── Badge & Tag pills ────────────────────────────────────────────────────── */
.badge-pill-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Surface + persistent rune-edge seal come from .af-seal. */
.badge-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px 12px;
}

.badge-icon {
  color: #a78bfa;
  flex-shrink: 0;
}

.badge-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #c4b5fd;
}

.badge-date {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: var(--text3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Body-level tooltip ───────────────────────────────────────────────────── */
#portalTooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #1a1030;
  border: 1px solid rgba(124,58,237,0.45);
  border-top: 2px solid var(--amber);
  padding: 10px 14px 12px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: var(--text2);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  box-shadow:
    0 0 24px rgba(124,58,237,0.2),
    0 8px 24px rgba(0,0,0,0.6);
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}

.tip-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--amber2);
  opacity: 0.7;
  margin-bottom: 6px;
}

.tip-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.tip-bullet {
  font-size: 6px;
  color: var(--amber);
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

/* Error shake = .af-shake; the rune-pulse keyframe + reduced-motion guard live
   in foundry-ui.css (which also disables .hub-entering). */

/* ── Hub card entrance ────────────────────────────────────────────────────── */
@keyframes hub-enter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.hub-entering {
  animation: hub-enter 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Small UI text → text-grade serif ─────────────────────────────────────────
   These were the old monospace spots (labels, meta, codes). Cormorant is a
   display serif and reads thin at 11–13px, so the small stuff uses Spectral —
   the text-grade serif — instead. Headings and the .tab-btn tabs stay Cormorant. */
.hub-active-title,
.hub-meta,
.notif-ticket-id,
.notif-type,
.msg-type,
.stat-label,
.stat-value,
.history-date,
.success-code,
label,
input#codeInput,
.section-title,
.section-count,
.issue-state,
.issue-date,
.issue-view-btn,
.im-id,
.im-badge,
.im-section-title,
.im-bug-label,
.im-version-pill,
.im-platform-pill,
.im-comment-meta,
.im-char-count,
.entitlement-type,
.entitlement-claimed,
.badge-date,
#portalTooltip,
.settings-current-value,
.mm-body-content code,
.mm-gifts-label {
  font-family: 'Spectral', Georgia, serif;
  font-weight: 500;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 12px; }
  .hub-card { min-height: calc(100vh - 24px); }
  .hub-topbar, .hub-profile, .tab-content { padding-left: 16px; padding-right: 16px; }
  .tab-nav { padding: 0 8px; justify-content: flex-start; overflow-x: auto; }
  .tab-rail { display: none; }
  .tab-btn { padding: 9px 12px 7px; font-size: 17px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .issue-type, .issue-date { display: none; }
  .im-overlay { padding: 12px; }
  .im-panel { max-height: 92vh; }
  .im-header, .im-body { padding-left: 16px; padding-right: 16px; }
}

/* ── Settings tab ──────────────────────────────────────────────────────────── */

.settings-section {
  margin-bottom: 32px;
}
.settings-section:last-child {
  margin-bottom: 8px;
}
.settings-section .section-header {
  margin-top: 0;
}
.settings-hint {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.55;
  margin-bottom: 14px;
}
.settings-status {
  min-height: 18px;
  font-size: 13px;
  margin-top: 11px;
  line-height: 1.5;
  text-align: center;
  color: var(--text3);
}
.settings-status-ok    { color: var(--success); }
.settings-status-error { color: var(--danger); }

.settings-current-value {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: var(--text2);
  background: rgba(124,58,237,0.06);
  border-left: 2px solid rgba(124,58,237,0.4);
  padding: 7px 10px;
  margin-bottom: 14px;
  word-break: break-all;
}

.avatar-drop-zone {
  border: 1px dashed rgba(124,58,237,0.35);
  border-left: 2px solid rgba(124,58,237,0.4);
  background: rgba(124,58,237,0.04);
  padding: 20px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color .15s, background .15s;
  position: relative;
  overflow: hidden;
}
.avatar-drop-zone:hover,
.avatar-drop-zone.drag-over {
  border-color: rgba(124,58,237,0.7);
  background: rgba(124,58,237,0.09);
}
.avatar-drop-zone.drag-over { border-style: solid; }

.avatar-drop-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 13px;
  color: var(--text3);
  text-align: center;
  line-height: 1.5;
}
.avatar-browse-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.avatar-drop-preview {
  display: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(124,58,237,0.5);
  margin-bottom: 8px;
}

/* ── Message modal ─────────────────────────────────────────────── */
/* Open animation uses transform/opacity only, so .af-panel's carved-top
   clip-path (the corners) is preserved — the two can't share clip-path. */
.mm-panel {
  transform-origin: center bottom;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition: none;
}
.mm-panel.mm-open {
  animation: mm-open 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes mm-open {
  0%   { opacity: 0; transform: translateY(14px) scale(0.96); }
  100% { opacity: 1; transform: none; }
}

/* Markdown body styles */
.mm-body-content { line-height: 1.7; font-size: 13.5px; color: var(--text2); }
.mm-body-content h2 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 16px; font-weight: 600; color: var(--text); margin: 20px 0 8px; }
.mm-body-content h3 { font-size: 14px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: 0.05em; margin: 16px 0 6px; }
.mm-body-content strong { color: var(--text); font-weight: 600; }
.mm-body-content em { color: #c084fc; font-style: italic; }
.mm-body-content p { margin: 0 0 10px; }
.mm-body-content p:last-child { margin-bottom: 0; }
.mm-body-content ul, .mm-body-content ol { padding-left: 20px; margin: 0 0 10px; }
.mm-body-content li { margin-bottom: 4px; }
.mm-body-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.mm-body-content a:hover { color: #a78bfa; }
.mm-body-content hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 16px 0; }
.mm-body-content code { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 13px; background: rgba(124,58,237,0.12); border: 1px solid rgba(124,58,237,0.2); border-radius: 3px; padding: 1px 5px; color: #c084fc; }
.mm-body-content blockquote { border-left: 3px solid rgba(124,58,237,0.5); margin: 0 0 10px; padding: 6px 12px; color: var(--text3); font-style: italic; }

/* ── Hub header icon actions (bell / envelope) ──────────────────── */
.hub-icon-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.hub-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease;
  padding: 0;
}
.hub-icon-btn:hover {
  background: rgba(124,58,237,0.12);
}
.hub-icon-btn.active {
  background: rgba(124,58,237,0.2);
}
.hub-icon-btn svg {
  opacity: 0.65;
  transition: opacity 150ms ease;
}
.hub-icon-btn:hover svg,
.hub-icon-btn.active svg {
  opacity: 1;
}
.hub-icon-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  pointer-events: none;
  border: 1.5px solid var(--surface);
}

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 0 4px;
}
.pagination-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
}
.pagination-btn:hover:not(:disabled) {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.5);
  color: var(--text);
}
.pagination-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.pagination-info {
  font-size: 13px;
  color: var(--text3);
  min-width: 72px;
  text-align: center;
}

/* ── Message modal — gifts section ─────────────────────────────── */
.mm-gifts {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(124,58,237,0.2);
}
.mm-gifts-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--amber2);
  margin-bottom: 10px;
}
.mm-gifts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mm-gift-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}
.mm-gift-item svg {
  flex-shrink: 0;
  color: var(--amber2);
}
