/* Geneguessr Styles */

#geneguessr-root {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Sidebar Stats */
.pg-sidebar-stats {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--light);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.pg-sidebar-section {
  margin-bottom: 1rem;
}

.pg-sidebar-section:last-child {
  margin-bottom: 0;
}

.pg-sidebar-label {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

.pg-sidebar-hints {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.pg-sidebar-stats-grid {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--dark);
}

.pg-sidebar-stat-label {
  color: var(--secondary);
  font-size: 0.85rem;
}

/* Auth section */
.pg-auth-section {
  border-bottom: 1px solid var(--ui-border);
  padding-bottom: 1rem;
}

.pg-auth-signin {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #5865f2;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}

.pg-auth-signin:hover {
  background: #4752c4;
  color: white;
}

.pg-auth-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pg-auth-username {
  font-weight: 600;
  color: var(--dark);
}

.pg-auth-tier {
  font-size: 0.85rem;
  color: var(--secondary);
  text-transform: capitalize;
}

.pg-auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
  margin-top: 0.35rem;
}

.pg-auth-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: #5865f2;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.pg-auth-discord:hover {
  background: #4752c4;
  color: #fff;
  transform: translateY(-1px);
}

.pg-auth-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.9rem;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  color: var(--dark);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.pg-auth-logout:hover {
  background: var(--light);
  border-color: var(--secondary);
}

/* Legacy structure card (no longer used) */
.pg-structure-card {
  margin-bottom: 1.5rem;
}

.pg-structure-viewer {
  position: relative;
  width: 100%;
  height: 320px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-bg);
  overflow: hidden;
}

/* Card-embedded structure viewer with 16:9 aspect ratio */
.pg-card-structure {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pg-card-structure-viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-bg);
  overflow: hidden;
}

.pg-structure-placeholder,
.pg-structure-loading,
.pg-structure-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: var(--secondary);
  gap: 0.5rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(245,245,245,0.9));
}

.pg-structure-source {
  font-size: 0.8rem;
  text-align: right;
  color: var(--secondary);
  letter-spacing: 0.02em;
}

.pg-structure-source[data-structure-source="alphafold"] {
  color: var(--accent);
  font-weight: 600;
}

:root[data-theme="dark"] .pg-structure-source-link {
  color: #9fd5ff;
}

.pg-structure-source-link {
  color: var(--accent);
  text-decoration: underline;
}

:root[data-theme="dark"] .pg-structure-source:not([data-structure-source="alphafold"]) {
  color: var(--gray);
}

:root[data-theme="dark"] .pg-structure-placeholder,
:root[data-theme="dark"] .pg-structure-loading,
:root[data-theme="dark"] .pg-structure-error {
  background: rgba(0, 0, 0, 0.5);
}

.pg-structure-tip {
  font-size: 0.8rem;
  color: var(--gray);
}

.pg-structure-error {
  color: #b00020;
  font-weight: 600;
}

.pg-structure-viewer,
.pg-structure-viewer canvas,
.pg-card-structure-viewer,
.pg-card-structure-viewer canvas {
  background-color: rgb(248, 241, 231);
}

:root[data-theme="dark"] .pg-structure-viewer,
:root[data-theme="dark"] .pg-structure-viewer canvas,
:root[data-theme="dark"] .pg-card-structure-viewer,
:root[data-theme="dark"] .pg-card-structure-viewer canvas {
  background-color: rgb(17, 12, 10);
}

.pg-structure-viewer canvas,
.pg-card-structure-viewer canvas {
  border-radius: 8px;
}

/* Hide remaining Molstar UI controls that can't be hidden via API */
.pg-structure-viewer .msp-viewport-controls button[title="Reset Camera"],
.pg-structure-viewer .msp-viewport-controls button[title*="Reset"],
.pg-structure-viewer .msp-viewport-controls button[title*="Screenshot"],
.pg-structure-viewer .msp-viewport-controls button[title*="State"],
.pg-card-structure-viewer .msp-viewport-controls button[title="Reset Camera"],
.pg-card-structure-viewer .msp-viewport-controls button[title*="Reset"],
.pg-card-structure-viewer .msp-viewport-controls button[title*="Screenshot"],
.pg-card-structure-viewer .msp-viewport-controls button[title*="State"] {
  display: none !important;
}

.pg-structure-viewer .msp-viewport-info,
.pg-structure-viewer .msp-hover-hint,
.pg-structure-viewer .msp-controls-wrapper,
.pg-structure-viewer .msp-top-left-controls,
.pg-structure-viewer .msp-top-center-controls,
.pg-structure-viewer .msp-bottom-left-controls,
.pg-structure-viewer .msp-bottom-center-controls,
.pg-structure-viewer .msp-highlight-info,
.pg-structure-viewer .msp-sequence-wrapper,
.pg-card-structure-viewer .msp-viewport-info,
.pg-card-structure-viewer .msp-hover-hint,
.pg-card-structure-viewer .msp-controls-wrapper,
.pg-card-structure-viewer .msp-top-left-controls,
.pg-card-structure-viewer .msp-top-center-controls,
.pg-card-structure-viewer .msp-bottom-left-controls,
.pg-card-structure-viewer .msp-bottom-center-controls,
.pg-card-structure-viewer .msp-highlight-info,
.pg-card-structure-viewer .msp-sequence-wrapper {
  display: none !important;
}

/* Disable pointer events on hover tooltips and info boxes */
.pg-structure-viewer .msp-highlight-info-wrapper,
.pg-card-structure-viewer .msp-highlight-info-wrapper {
  display: none !important;
  pointer-events: none !important;
}

.pg-how-to-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: var(--ui-bg);
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.pg-how-to-play:hover {
  background: var(--light);
  border-color: var(--dark);
}

:root[data-theme="dark"] .pg-how-to-play {
  color: var(--light, #f8f1e7);
  border-color: rgba(255, 255, 255, 0.2);
}

:root[data-theme="dark"] .pg-how-to-play:hover {
  background: rgba(255, 255, 255, 0.08);
}

.pg-tutorial-overlay {
  position: fixed;
  inset: 0;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1050;
}

.pg-tutorial-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.pg-tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
}

.pg-tutorial-card {
  position: relative;
  width: min(540px, 100%);
  padding: 2rem 2rem 1.5rem;
  border-radius: 18px;
  background: var(--ui-bg);
  color: var(--dark);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.5);
  z-index: 1;
}

:root[data-theme="dark"] .pg-tutorial-card {
  background: rgba(15, 23, 42, 0.95);
  color: var(--light, #f8f1e7);
}

.pg-tutorial-skip {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}

.pg-tutorial-status {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--secondary);
}

.pg-tutorial-content h2 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

.pg-tutorial-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pg-tutorial-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.pg-tutorial-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--ui-border);
  background: var(--light);
  color: var(--dark);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.pg-tutorial-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

:root[data-theme="dark"] .pg-tutorial-nav-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--light, #f8f1e7);
}

.pg-tutorial-forward.is-play {
  border-radius: 999px;
  width: auto;
  padding: 0.5rem 1.5rem;
}

.pg-tutorial-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1;
}

.pg-tutorial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--ui-border);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.pg-tutorial-dot.is-active {
  transform: scale(1.2);
  background: var(--dark);
}

:root[data-theme="dark"] .pg-tutorial-dot.is-active {
  background: var(--light, #f8f1e7);
}

.pg-tutorial-footer {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pg-tutorial-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--secondary);
}

.pg-tutorial-locked {
  overflow: hidden;
}

@media (max-width: 600px) {
  .pg-tutorial-card {
    padding: 1.5rem;
  }

  .pg-tutorial-nav-btn {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-tutorial-overlay {
    transition: none;
  }

  .pg-tutorial-dot,
  .pg-tutorial-nav-btn {
    transition: none;
  }
}

@media (max-width: 600px) {
  .pg-structure-viewer {
    height: 260px;
  }
  
  /* Card viewer maintains 16:9 ratio on mobile */
  .pg-card-structure-viewer {
    aspect-ratio: 16 / 9;
  }
}

/* Clue Card */
/* Unified Card Styling */
.pg-clue-card,
.pg-feedback-card {
  position: relative;
  background: var(--light);
  border-radius: 8px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  isolation: isolate;
}

.pg-clue-card::after,
.pg-feedback-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--ui-border);
  z-index: 1;
}

.pg-clue-card > *,
.pg-feedback-card > * {
  position: relative;
  z-index: 2;
}

.pg-clue-card {
  padding: 0.75rem 1rem;
}

/* Unified Section Styling - used by both clue and feedback cards */
.pg-section {
  margin-bottom: 0.4rem;
  line-height: 1.5;
  font-size: 0.95rem;
  color: var(--dark);
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  text-wrap: pretty;
}

@supports not (overflow-wrap: anywhere) {
  .pg-section {
    overflow-wrap: break-word;
  }
}

.pg-section:last-child {
  margin-bottom: 0;
}

.pg-section-label {
  font-weight: 600;
  color: var(--secondary);
}

.pg-section-entry {
  display: inline;
  vertical-align: baseline;
  max-width: 100%;
}

.pg-section-entry:not(:last-child)::after {
  content: ", ";
}

.pg-section-entry.matched-highlight {
  color: var(--accent);
  font-weight: 600;
  text-shadow: 0 0 6px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Gene summary styling */
.pg-gene-summary {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--secondary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--lightgray);
}

.pg-gene-summary-source {
  opacity: 0.7;
  font-size: 0.8em;
  margin-left: 0.35rem;
  font-style: normal;
  text-decoration: none;
  color: var(--secondary);
}

.pg-gene-summary-source:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Legacy aliases for backward compatibility */
.pg-clue-section {
  margin-bottom: 0.4rem;
  line-height: 1.5;
  font-size: 0.95rem;
  color: var(--dark);
  overflow-wrap: break-word;
  word-break: break-word;
}

.pg-clue-section:last-child {
  margin-bottom: 0;
}

.pg-clue-label-inline {
  font-weight: 600;
  color: var(--secondary);
}

.pg-clue-entry {
  display: inline-block;
  vertical-align: top;
  max-width: 100%;
  margin-right: 0.35rem;
}

.pg-clue-entry:last-child {
  margin-right: 0;
}

/* Redaction/Spoiler Styling */
.pg-redaction {
  display: inline;
  cursor: pointer;
  user-select: none;
  color: transparent;
  background: var(--dark);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: opacity 0.15s ease;
}

.pg-redaction:hover,
.pg-redaction:focus-visible {
  opacity: 0.85;
}

.pg-redaction:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.pg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pg-chip {
  background: var(--light);
  border: 1px solid var(--darkgray);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--dark);
}

.pg-chip.matched {
  background: oklch(50% 0.08 185);
  color: white;
  border-color: oklch(50% 0.08 185);
}

/* Dark mode override for matched chips */
@media (prefers-color-scheme: dark) {
  .pg-chip.matched {
    background: oklch(68% 0.08 185);
    border-color: oklch(68% 0.08 185);
  }
}

:root[data-theme="dark"] .pg-chip.matched {
  background: oklch(68% 0.08 185);
  border-color: oklch(68% 0.08 185);
}

.pg-chip.unmatched {
  background: var(--gray);
  color: var(--light);
  border-color: var(--gray);
}

.pg-flags {
  display: flex;
  gap: 1rem;
}

.pg-flag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--dark);
}

.pg-subtext {
  font-size: 0.85rem;
  color: var(--secondary);
  margin-top: 0.35rem;
}

.pg-flag-icon {
  font-size: 1.2rem;
}

/* Input */
.pg-input-section {
  margin-bottom: 1.5rem;
}

.pg-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pg-autocomplete-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.pg-input {
  width: 100%;
  padding: 0.75rem 3rem 0.75rem 0.75rem;
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--light);
  color: var(--dark);
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pg-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 139, 92, 246), 0.1);
}

.pg-input:disabled {
  background: var(--lightgray);
  cursor: not-allowed;
}

.pg-submit-inline {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pg-submit-inline:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pg-submit-inline:active:not(:disabled) {
  transform: translateY(-50%) scale(0.98);
}

.pg-submit-inline:disabled {
  background: var(--gray);
  cursor: not-allowed;
  opacity: 0.5;
}

.pg-submit-inline svg {
  width: 20px;
  height: 20px;
}

.pg-hints-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--light);
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  white-space: nowrap;
  font-size: 0.95rem;
}

.pg-hints-label {
  color: var(--secondary);
  font-weight: 500;
}

.pg-hints-value {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}

.pg-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--light);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pg-suggestion {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--ui-border);
  color: var(--dark);
  transition: background 0.15s ease;
}

.pg-suggestion:hover,
.pg-suggestion.selected {
  background: var(--ui-bg);
}

.pg-suggestion-title {
  font-weight: 600;
  color: var(--dark);
}

.pg-suggestion-sub {
  font-size: 0.85rem;
  color: var(--secondary);
  margin-top: 0.15rem;
}

.pg-suggestion:last-child {
  border-bottom: none;
}

@media (max-width: 600px) {
  .pg-input-row {
    flex-wrap: wrap;
  }
  
  .pg-autocomplete-wrapper {
    width: 100%;
  }
  
  .pg-hints-badge {
    margin-left: auto;
  }
}

/* Feedback Panel */
.pg-feedback {
  background: var(--light);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.pg-feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ui-border);
}

.pg-feedback-protein {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--dark);
}

.pg-feedback-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.pg-feedback-label {
  font-size: 0.9rem;
  color: var(--secondary);
}

.pg-feedback-value {
  font-weight: 600;
  color: var(--dark);
}

.pg-feedback-note {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--secondary);
}

.pg-bar {
  height: 6px;
  background: var(--lightgray);
  border-radius: 3px;
  overflow: hidden;
  flex: 1;
  margin: 0 0.75rem;
}

.pg-bar-fill {
  height: 100%;
  background: var(--secondary);
  transition: width 0.3s ease;
}

/* Collapsible Feedback Cards - now using unified card styling above */
.pg-feedback-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pg-collapse-toggle {
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
  transition: background-color 0.2s ease;
}

.pg-collapse-toggle:hover {
  background-color: var(--lightgray);
}

.pg-collapse-toggle:focus {
  outline: none;
}

.pg-static-toggle {
  cursor: default;
}

.pg-static-toggle:hover {
  background-color: transparent;
}

.pg-static-toggle:focus {
  outline: none;
}

.pg-collapse-chevron {
  font-size: 0.9rem;
  color: var(--secondary);
  flex-shrink: 0;
  width: 1rem;
  transition: transform 0.2s ease;
}

.pg-feedback-gene {
  font-weight: 700;
  font-size: 1rem;
  color: var(--dark);
  flex-shrink: 0;
}

.pg-feedback-score {
  font-weight: 600;
  color: var(--dark);
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.pg-feedback-content {
  padding: 0 1rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.2s ease;
}

.pg-feedback-protein-name {
  font-size: 0.95rem;
  color: var(--secondary);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
  .pg-feedback-content {
    transition: none;
  }
}

.pg-feedback-card.collapsed .pg-feedback-content {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.pg-feedback-card.expanded .pg-feedback-content {
  opacity: 1;
  padding: 0.75rem 1rem;
  padding-top: 0.5rem;
}

.pg-feedback-final .pg-feedback-content {
  opacity: 1;
  padding: 0.75rem 1rem;
  padding-top: 0.5rem;
  overflow: visible;
}

/* Result */
.pg-result {
  background: oklch(50% 0.08 185);
  color: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 1.5rem;
}

.pg-result.failed {
  background: var(--gray);
  color: var(--darkgray);
}

/* Dark mode overrides for results */
@media (prefers-color-scheme: dark) {
  .pg-result {
    background: oklch(68% 0.08 185);
  }
  
  .pg-result.failed {
    background: var(--darkgray);
    color: var(--lightgray);
  }
}

:root[data-theme="dark"] .pg-result {
  background: oklch(68% 0.08 185);
}

:root[data-theme="dark"] .pg-result.failed {
  background: var(--darkgray);
  color: var(--lightgray);
}

.pg-result-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.pg-result-protein {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.pg-result-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.pg-result-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.pg-play-again {
  border: 1px solid var(--ui-border);
  background: var(--light);
  color: var(--dark);
  border-radius: 999px;
  padding: 0.5rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.pg-play-again:hover {
  background: var(--ui-bg);
  border-color: var(--secondary);
}

.pg-link-btn {
  padding: 0.5rem 1rem;
  background: white;
  color: oklch(50% 0.08 185);
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.pg-link-btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

/* Failed card in light mode: cream bg with dark text on medium brown card */
.pg-result.failed .pg-link-btn {
  background: var(--light);
  color: var(--dark);
}

.pg-result.failed .pg-link-btn:hover {
  background: var(--ui-bg);
}

.pg-practice-tag,
.pg-practice-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
}

.pg-practice-tag {
  text-align: center;
}

.pg-practice-badge {
  align-self: flex-start;
  flex-shrink: 0;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--ui-border);
  background: var(--ui-bg);
}

/* Dark mode win card: white bg with dark text on light teal card */
@media (prefers-color-scheme: dark) {
  .pg-result:not(.failed) .pg-link-btn {
    background: white;
    color: var(--dark);
  }
  
  .pg-result:not(.failed) .pg-link-btn:hover {
    background: rgba(255, 255, 255, 0.9);
  }
  
  /* Failed card in dark mode: cream bg with dark text on light brown card */
  .pg-result.failed .pg-link-btn {
    background: var(--light);
    color: var(--dark);
  }
  
  .pg-result.failed .pg-link-btn:hover {
    background: var(--ui-bg);
  }
}

:root[data-theme="dark"] .pg-result:not(.failed) .pg-link-btn {
  background: white;
  color: var(--dark);
}

:root[data-theme="dark"] .pg-result:not(.failed) .pg-link-btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

:root[data-theme="dark"] .pg-result.failed .pg-link-btn {
  background: var(--light);
  color: var(--dark);
}

:root[data-theme="dark"] .pg-result.failed .pg-link-btn:hover {
  background: var(--ui-bg);
}

/* Share */
.pg-share-section {
  text-align: center;
  margin-top: 1.5rem;
}

.pg-share-btn {
  padding: 0.75rem 1.5rem;
  background: var(--dark);
  color: var(--light);
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.pg-share-btn:hover {
  opacity: 0.9;
}

.pg-share-feedback {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--secondary);
}

/* Stats */
.pg-stats {
  display: flex;
  justify-content: space-around;
  padding: 1rem;
  background: var(--light);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  margin-bottom: 1rem;
}

.pg-stat {
  text-align: center;
}

.pg-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
}

.pg-stat-label {
  font-size: 0.85rem;
  color: var(--secondary);
  text-transform: uppercase;
}

/* Mobile */
@media (max-width: 600px) {
  #geneguessr-root {
    padding: 0 0.5rem;
  }
  
  .pg-result-links {
    flex-direction: column;
  }
  
  .pg-stats {
    flex-wrap: wrap;
  }
}
