/**
 * Character Portrait Styling
 * Clean layout for character portrait and stats
 */

/* Wayfarer's Toy Box font - local */
@font-face {
  font-family: 'Wayfarer\'s Toy Box';
  src: url('/fonts/wayfarers-toy-box.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Header Character Portrait */
.character-portrait {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--colour-bg-secondary);
  border: 3px solid var(--colour-accent-main);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.character-portrait:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--colour-accent-light);
  transform: translateY(-2px);
}

.portrait-image {
  flex-shrink: 0;
}

.portrait-image img {
  width: 48px;
  height: 48px;
  border: 2px solid var(--colour-accent-main);
  border-radius: 4px;
  background-color: var(--colour-highlight-bg);
  image-rendering: pixelated;
  display: block;
}

.portrait-details {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.character-info {
  display: flex;
  align-items: center;
}

.character-name {
  font-family: 'Wayfarer\'s Toy Box', sans-serif;
  font-size: 1.5rem;
  font-weight: normal;
  color: var(--text-primary, #4a3f35);
  white-space: nowrap;
  line-height: 1;
}

.character-level {
  font-family: 'Wayfarer\'s Toy Box', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
  font-style: normal;
}

/* Stat Bars */
.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Hide stats by default until Konami mode */
.stat-bars.konami-only {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.15s ease, opacity 0.15s ease, margin-top 0.15s ease;
  margin-top: 0;
}

/* Show stats with slide-down animation in Konami mode */
body.konami-mode .stat-bars.konami-only {
  max-height: 200px;
  opacity: 1;
  margin-top: 0.5rem;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.stat-label {
  font-family: 'Wayfarer\'s Toy Box', sans-serif;
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
}

.stat-bar {
  flex: 1;
  height: 28px;
  min-height: 28px;
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid white;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  min-width: 100px;
  display: block;
}

.health-fill,
.energy-fill,
.xp-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 18px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.health-fill {
  background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
  width: 100%;
}

.energy-fill {
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
  width: 100%;
}

.xp-fill {
  background: linear-gradient(90deg, #a855f7 0%, #c084fc 100%);
  width: 0%;
}

.health-stat,
.energy-stat,
.xp-stat {
  font-family: 'Wayfarer\'s Toy Box', sans-serif;
  font-size: 0.9rem;
  font-weight: normal;
  color: white;
  white-space: nowrap;
  position: absolute;
  top: calc(50% + 2px);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Game UI Character Panel (Konami Mode) */
.game-character-panel {
  position: fixed;
  top: 20px;
  left: 20px;
  background: var(--colour-bg-secondary);
  border: 4px solid var(--colour-accent-main);
  border-radius: 12px;
  padding: 1.5rem;
  min-width: 280px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

.game-portrait {
  margin-bottom: 1rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.game-portrait:hover {
  transform: scale(1.05);
}

.game-portrait img {
  width: 96px;
  height: 96px;
  border: 3px solid var(--colour-accent-main);
  border-radius: 8px;
  image-rendering: pixelated;
  transition: border-color 0.2s ease;
}

.game-portrait:hover img {
  border-color: var(--colour-accent-light);
}

.game-info {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--colour-accent-main);
}

.game-info .character-name {
  font-family: 'Wayfarer\'s Toy Box', sans-serif;
  font-size: 1.5rem;
  font-weight: normal;
  margin-bottom: 0.25rem;
  line-height: 1;
}

.game-info .character-level {
  font-family: 'Wayfarer\'s Toy Box', sans-serif;
  font-size: 0.9rem;
}

.game-stat-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-stat-bars .stat-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-stat-bars .stat-label {
  font-family: 'Wayfarer\'s Toy Box', sans-serif;
  font-size: 1.35rem;
  font-weight: normal;
  width: 100%;
  text-align: left;
}

.game-stat-bars .stat-bar {
  height: 32px;
  width: 100%;
}

.game-stat-bars .health-stat,
.game-stat-bars .energy-stat,
.game-stat-bars .xp-stat {
  font-family: 'Wayfarer\'s Toy Box', sans-serif;
  font-size: 1rem;
}

/* Exit Hint */
.exit-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

/* Dark Theme Support */
[data-theme="dark"] .character-portrait {
  background: var(--colour-bg-secondary);
  border-color: var(--colour-accent-main);
}

[data-theme="dark"] .character-name {
  color: var(--colour-text-primary);
}

[data-theme="dark"] .character-level {
  color: var(--colour-text-secondary);
}

[data-theme="dark"] .portrait-image img {
  border-color: var(--colour-accent-main);
}

[data-theme="dark"] .stat-bar {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .game-character-panel {
  background: var(--colour-bg-secondary);
  border-color: var(--colour-accent-main);
}

[data-theme="dark"] .game-info {
  border-bottom-color: var(--colour-accent-main);
}

/* Responsive Design */
@media (max-width: 768px) {
  .character-portrait {
    max-width: 100%;
    padding: 0.75rem;
  }

  .portrait-image img {
    width: 40px;
    height: 40px;
  }

  .character-name {
    font-size: 1.2rem;
  }

  .character-level {
    font-size: 0.75rem;
  }

  .stat-row {
    font-size: 0.7rem;
  }

  .stat-label {
    font-size: 0.85rem;
    width: 18px;
  }

  .stat-bar {
    height: 10px;
    min-width: 60px;
  }

  .game-character-panel {
    min-width: 220px;
    padding: 1rem;
    top: 10px;
    left: 10px;
  }

  .game-portrait img {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 480px) {
  .character-portrait {
    flex-direction: column;
    text-align: center;
  }

  .portrait-image img {
    width: 48px;
    height: 48px;
  }

  .character-name {
    font-size: 1.2rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .character-portrait,
  .health-fill,
  .energy-fill,
  .xp-fill {
    transition: none;
  }
}
