/* style.css */
/* Global styles for Tarnished & Rising */
/* Dark fantasy aesthetic — near-black to deep warm charcoal, gold accents */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: 'Crimson Pro', serif;
  font-size: 16px;
  color: #e8dcc8;
  background: #0f0d0a;
}

/* --- CSS Variables --- */
:root {
  --gold: #c9a84c;
  --gold-light: #e8c96a;
  --gold-dim: #8a6f32;
  --amber: #d4813a;
  --red: #E84855;
  --green: #52B788;
  --blue: #60A0FF;
  --purple: #7B5EA7;
  --orange: #E87D3E;

  --bg-dark: #0f0d0a;
  --bg-card: #1e1a14;
  --bg-card-hover: #2a2318;
  --bg-overlay: rgba(0, 0, 0, 0.85);

  --text-primary: #e8dcc8;
  --text-secondary: #a89880;
  --text-dim: #6a5f50;

  --border-gold: 1px solid #3a2f1a;
  --border-gold-bright: 1px solid #c9a84c;

  --nav-height: 64px;
  --header-height: 56px;

  --tab-active: #c9a84c;
  --tab-inactive: #6a6460;
}

/* --- App Background --- */
body {
  background: linear-gradient(
    180deg,
    #0f0d0a 0%,
    #1a1410 60%,
    #1f1508 100%
  );
}

/* --- Screen System --- */
/* Screens are full-page views — only one visible at a time */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* --- Profile Select Screen --- */
.profile-select-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 16px;
  gap: 28px;
}

.logo {
  width: 340px;
  max-width: 88%;
  object-fit: contain;
}

.profile-prompt {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--gold);
  text-transform: uppercase;
  text-align: center;
}

/* Decorative divider under logo */
.profile-prompt::before {
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: var(--gold-dim);
  margin: 0 auto 16px;
}

.player-list {
  display: flex;
  flex-direction: row;
  gap: 12px;
  width: 100%;
  justify-content: center;
  align-items: stretch;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 140px;
  background: var(--bg-card);
  border: 1px solid #5a4a28;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 12px rgba(201, 168, 76, 0.08);
}

.player-card:active {
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(201, 168, 76, 0.4);
}

.player-card:hover {
  border-color: var(--gold-dim);
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.2);
}

.player-card-portrait-wrap {
  width: 100%;
  aspect-ratio: 3/4;
  position: relative;
  overflow: hidden;
}

.player-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.player-portrait-placeholder {
  width: 100%;
  height: 100%;
  background: #2a2318;
}

.player-card-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 40%,
    rgba(10, 8, 5, 0.85) 100%
  );
}

.player-card-footer {
  width: 100%;
  padding: 12px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--bg-card);
}

.player-name {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-align: center;
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
}

.player-class {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-align: center;
}

/* --- PIN Screen --- */
.pin-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 24px;
  gap: 20px;
}

.pin-player-name {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  color: var(--gold);
}

.pin-prompt {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
}

.pin-dots {
  display: flex;
  gap: 16px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--gold-dim);
  background: transparent;
  transition: background 0.1s;
}

.pin-dot.filled {
  background: var(--gold);
  border-color: var(--gold);
}

.pin-error {
  font-size: 13px;
  color: var(--red);
  min-height: 18px;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  grid-template-rows: repeat(4, 72px);
  gap: 12px;
}

.pin-key {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: var(--border-gold);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Cinzel', serif;
  font-size: 22px;
  cursor: pointer;
  transition: background 0.1s;
}

.pin-key:active {
  background: var(--bg-card-hover);
}

.pin-key--blank {
  background: transparent;
  border: none;
  cursor: default;
}

.pin-key--delete {
  font-size: 18px;
}

.pin-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  cursor: pointer;
  padding: 8px;
}

/* --- App Shell --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: rgba(15, 13, 10, 0.95);
  border-bottom: var(--border-gold);
  flex-shrink: 0;
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
}

.header-logo {
  height: 42px;
  object-fit: contain;
}

.header-grace {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.header-flame-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.tab-panel {
  display: none;
  padding: 16px;
  min-height: 100%;
}

.tab-panel.active {
  display: block;
}

.placeholder-text {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  margin-top: 40px;
}

/* --- Bottom Nav --- */
.bottom-nav {
  display: flex;
  height: var(--nav-height);
  background: rgba(15, 13, 10, 0.98);
  border-top: var(--border-gold);
  flex-shrink: 0;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
}

.nav-btn span {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--tab-inactive);
  transition: color 0.15s;
}

.nav-btn .nav-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(42%) sepia(6%) saturate(547%) hue-rotate(338deg) brightness(95%) contrast(85%);
  transition: filter 0.15s;
}

.nav-btn.active span {
  color: var(--tab-active);
}

.nav-btn.active .nav-icon {
  filter: brightness(0) saturate(100%) invert(68%) sepia(35%) saturate(600%) hue-rotate(5deg) brightness(95%) contrast(90%);
}