/* Viewer-specific layout and controls */

/* Compact header — replaces the big centered page-header */
.viewer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary, #1a1a2e);
  border: 1px solid var(--border-color, #3a3a5c);
  border-radius: 12px;
  margin-bottom: clamp(0.75rem, 3vw, 1.25rem);
}

.viewer-header__logo {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 10px rgba(245, 166, 35, 0.4));
}

.viewer-header__title {
  color: var(--accent-primary, #f5a623);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  margin: 0;
}

.viewer-header__subtitle {
  color: var(--text-dim, #6b6b8d);
  font-size: 0.75rem;
  margin: 2px 0 0;
}

/* Hide the big nav logo on the viewer page — compact header is enough.
   Scoped to the viewer header: /app/ and /play/ also load this stylesheet
   and an unscoped rule stripped the brand flame out of their nav bars. */
body:has(.viewer-header) .nav-logo {
  display: none;
}

.viewer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.viewer-player-picker {
  display: grid;
  gap: 8px;
  min-width: min(100%, 320px);
}

.viewer-select {
  background: var(--bg-tertiary, #252542);
  color: var(--text-primary, #fff);
  border: 1px solid var(--border-color, #3a3a5c);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-width: 260px;
  cursor: pointer;
}

.viewer-profile {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 5px 7px;
  border: 1px solid color-mix(in srgb, var(--profile-color, #7c2bff) 45%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--profile-color, #7c2bff) 8%, var(--bg-tertiary, #252542));
}

.viewer-profile[hidden] {
  display: none;
}

.viewer-profile__avatar {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 2px solid var(--profile-color);
  border-radius: 50%;
  background: #111;
  box-shadow: 0 0 12px color-mix(in srgb, var(--profile-color) 42%, transparent);
}

.viewer-profile__avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer-profile__avatar-frame,
.viewer-profile__avatar-image {
  z-index: 1;
}

.viewer-profile__avatar.is-layered .viewer-profile__avatar-frame {
  inset: -17%;
  width: 134%;
  height: 134%;
}

.viewer-profile__avatar-mark {
  z-index: 2;
  top: 25% !important;
  left: 28% !important;
  width: 44% !important;
  height: 50% !important;
}

.viewer-profile__copy {
  min-width: 0;
}

.viewer-profile__copy strong,
.viewer-profile__copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-profile__copy strong {
  color: var(--text-primary, #fff);
  font-size: 0.78rem;
}

.viewer-profile__copy span {
  margin-top: 1px;
  color: var(--text-dim, #6b6b8d);
  font-size: 0.66rem;
}

.viewer-profile__type {
  color: var(--profile-color, #7c2bff);
  font-size: 0.57rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.viewer-no-activity {
  text-align: center;
}

.viewer-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.viewer-select option {
  background: var(--bg-secondary, #1a1a2e);
  color: var(--text-secondary, #a0a0c0);
}

.viewer-scrubber {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 300px;
}

.viewer-scrubber__track {
  flex: 1;
}

.viewer-scrubber__track input[type="range"] {
  width: 100%;
  accent-color: var(--accent-primary, #f5a623);
  cursor: pointer;
}

.viewer-scrubber__day-label {
  color: var(--accent-primary, #f5a623);
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  min-width: 100px;
}

.viewer-scrubber__jump {
  background: var(--bg-tertiary, #252542);
  color: var(--text-primary, #fff);
  border: 1px solid var(--border-color, #3a3a5c);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.8rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  width: 64px;
  text-align: center;
}

.viewer-scrubber__jump::-webkit-inner-spin-button,
.viewer-scrubber__jump::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.viewer-scrubber__jump {
  -moz-appearance: textfield;
}

.viewer-empty {
  text-align: center;
  padding: 48px 16px;
}

.viewer-empty h2 {
  color: var(--text-secondary, #a0a0c0);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.viewer-empty p {
  color: var(--text-dim, #6b6b8d);
  font-size: 0.8rem;
  max-width: 400px;
  margin: 0 auto;
}

.viewer-error {
  color: var(--error, #ef4444);
  font-size: 0.72rem;
  margin-top: 4px;
}

/* Phase 25 panel styles */

.text-dim {
  color: var(--text-dim, #6b6b8d);
  font-size: 0.8rem;
}

.badge-bought {
  display: inline-block;
  background: rgba(34, 197, 94, 0.15);
  color: var(--success, #22c55e);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.activity-panel .section-title,
.store-panel .section-title {
  margin-top: 1rem;
}

.activity-panel .section-title:first-of-type,
.store-panel .section-title:first-of-type {
  margin-top: 0;
}

/* Badge inventory */

.badge-inventory__summary {
  color: var(--text-dim, #6b6b8d);
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.badge-inventory__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.badge-inventory__quadrant {
  background: var(--bg-tertiary, #252542);
  border-radius: 8px;
  padding: 8px 10px;
}

.badge-inventory__quadrant-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary, #f5a623);
  margin-bottom: 6px;
}

.badge-inventory__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 0.75rem;
}

.badge-inventory__item + .badge-inventory__item {
  border-top: 1px solid var(--border-subtle, #2a2a45);
}

.badge-inventory__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.badge-inventory__items {
  max-height: 200px;
  overflow-y: auto;
}

.badge-inventory__name {
  color: var(--text-secondary, #a0a0c0);
  text-transform: capitalize;
}

.badge-inventory__name {
  flex: 1;
}

.badge-inventory__count {
  color: var(--text-primary, #fff);
  font-weight: 700;
  font-size: 0.75rem;
  min-width: 20px;
  text-align: right;
}

.badge-inventory__quadrant-count {
  color: var(--text-dim, #6b6b8d);
  font-size: 0.6rem;
  font-weight: 400;
}

/* Phase 26 -- Coinflip display panel */

.coinflip-display-wrapper {
  perspective: 600px;
}

.coinflip-display-panel {
  transform-style: preserve-3d;
}

.coinflip-display-panel h2 {
  /* Inherits from panels.css .panel h2 */
}

.cf-card {
  padding: 0.5rem 0;
}

.cf-result-indicator {
  font-size: 1.4rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 0.75rem 0;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.cf-win {
  color: var(--success, #22c55e);
  background: rgba(34, 197, 94, 0.12);
}

.cf-loss {
  color: var(--error, #ef4444);
  background: rgba(239, 68, 68, 0.12);
}

.cf-pending {
  color: var(--text-dim, #6b6b8d);
  background: rgba(107, 107, 141, 0.12);
}

/* Phase 26 -- Replay wrapper */

#replay-wrapper {
  margin-top: clamp(0.75rem, 3vw, 1.25rem);
}

#replay-wrapper replay-panel {
  display: block;
}

/* Hide replay panel's redundant day/player selects — viewer controls drive selection */
/* But keep the Reveal Draw button visible */
#replay-wrapper .replay-control-group {
  display: none;
}

#replay-wrapper .replay-reveal-btn {
  display: inline-block;
}

/* Phase 26 -- Layout polish (D-11) */

#viewer-content > .panel:last-child {
  margin-bottom: 0;
}
