/* CSS Variables matching ragzbuilds */
:root {
  --ink: #111;
  --paper: #fff;
  --muted: #666;
  --success: #2d7a2d;
  --danger: #a33;
  --warning: #b86e00;
  --sabotage: #7a2d7a;
}

/* Base styles */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Short Stack", "Schoolbell", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
}

/* Layout */
.wrap {
  max-width: 600px;
  margin-inline: auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  padding: 8px 0;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 36px);
  letter-spacing: 0.3px;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

header h1::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  bottom: 0;
  background: no-repeat left center / 100% 8px url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 8'><path d='M2 4 Q 15 0 28 4 T 54 4 T 80 4 T 106 4 T 132 4 T 158 4 T 184 4' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

.home-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.home-link:hover {
  opacity: 1;
}

/* Screens */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen.hidden {
  display: none;
}

/* Start Screen */
.intro-card {
  border: 3px dashed var(--ink);
  border-radius: 16px;
  padding: 24px;
  margin: 16px 0;
}

.intro-card h2 {
  margin: 0 0 16px;
  font-size: clamp(20px, 4vw, 28px);
  text-align: center;
}

.story-text {
  margin-bottom: 20px;
}

.story-text p {
  margin: 8px 0;
  font-size: 15px;
}

.story-text .warning {
  color: var(--danger);
  font-weight: bold;
  margin-top: 16px;
}

.family-intro {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 12px;
}

.family-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  min-width: 70px;
}

.family-member.antagonist {
  background: #ffe0e0;
  border-radius: 8px;
}

.member-icon {
  font-size: 24px;
}

.member-name {
  font-size: 11px;
  font-weight: bold;
  margin-top: 4px;
}

.member-role {
  font-size: 10px;
  color: var(--muted);
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 24px;
  margin: 16px 0 8px;
  font-family: inherit;
  font-size: 18px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}

/* Game Screen - Status Bar */
.status-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px;
  background: #f5f5f5;
  border-radius: 12px;
  margin-bottom: 12px;
}

.time-display {
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-display .label {
  font-size: 11px;
  color: var(--muted);
}

.time-display .value {
  font-size: 18px;
  font-weight: bold;
}

.time-display .separator {
  color: var(--muted);
  margin: 0 4px;
}

/* Day counter with tick animation */
.time-display .day-value {
  min-width: 24px;
  text-align: center;
  transition: transform 0.15s ease-out;
}

.time-display .day-value.tick {
  animation: dayTick 0.3s ease-out;
}

@keyframes dayTick {
  0% {
    transform: scale(1);
    color: var(--ink);
  }

  50% {
    transform: scale(1.3);
    color: var(--success);
  }

  100% {
    transform: scale(1);
    color: var(--ink);
  }
}

/* Combined Vitals Section - Dual Health & Savings */
.vitals-section {
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fafafa;
}

/* Dual Health Bars Row */
.health-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.health-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.health-icon {
  font-size: 14px;
}

.health-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  min-width: 32px;
}

.health-bar {
  flex: 1;
  height: 12px;
  background: #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.health-fill {
  height: 100%;
  width: 100%;
  transition: width 0.5s ease, background 0.3s;
}

.health-fill.physical {
  background: #e74c3c;
  /* Red for body */
}

.health-fill.mental {
  background: #9b59b6;
  /* Purple for mind */
}

.health-fill.peace {
  background: #3498db;
  /* Blue for family peace */
}

.health-fill.influence {
  background: #e67e22;
  /* Orange for influence/social capital */
}

.health-item.full-width {
  flex: 1 1 100%;
}

.health-row.hidden {
  display: none;
}

.health-item.hidden {
  display: none;
}

/* When mental health item is hidden, make physical (sanity) full width */
.health-row:has(.health-item.hidden) .health-item:not(.hidden) {
  flex: 1 1 100%;
}

.health-fill.warning {
  opacity: 0.8;
}

.health-fill.danger {
  animation: pulse-danger 1s ease-in-out infinite;
}

@keyframes pulse-danger {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.health-value {
  font-size: 12px;
  font-weight: bold;
  min-width: 24px;
  text-align: right;
}

/* Godavari Special Abilities */
.godavari-specials {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid #e0d5c0;
}

.godavari-specials.hidden {
  display: none;
}

.special-btn {
  flex: 1;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  color: var(--paper);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  position: relative;
}

.special-btn::after {
  content: 'ONE USE';
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  background: var(--danger);
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
}

.special-btn:hover:not(:disabled) {
  background: #333;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.35);
}

.special-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  background: #222;
}

.special-btn.used {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: #bbb;
  background: #ccc;
  box-shadow: none;
  color: #888;
}

.special-btn.used::after {
  content: 'USED';
  background: #999;
}

/* Savings Row */
.savings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
}

.savings-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  min-width: 48px;
}

.progress-bar {
  flex: 1;
  height: 12px;
  background: #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a9 0%, #2d7a2d 100%);
  transition: width 0.5s ease;
  border-radius: 6px;
}

.vital-value {
  font-size: 12px;
  font-weight: bold;
  min-width: 32px;
  text-align: right;
}

/* Money Display */
.money-display {
  text-align: center;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
}

.money-display .rupee {
  font-size: 18px;
}

.money-value {
  font-size: 36px;
  font-weight: bold;
  transition: color 0.3s;
}

.money-value.positive {
  color: var(--success);
}

.money-value.negative {
  color: var(--danger);
}

.money-goal-text {
  font-size: 16px;
  color: var(--muted);
}

/* Flash animations for value changes */
.money-value.flash-positive {
  animation: flashGreen 0.6s ease-out;
}

.money-value.flash-negative {
  animation: flashRed 0.6s ease-out;
}

@keyframes flashGreen {
  0% {
    background: #4ade80;
    color: white;
    transform: scale(1.1);
  }

  100% {
    background: transparent;
    transform: scale(1);
  }
}

@keyframes flashRed {
  0% {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
  }

  100% {
    background: transparent;
    transform: scale(1);
  }
}

/* Health bar flash */
.health-bar.flash {
  animation: barFlash 0.4s ease-out;
}

@keyframes barFlash {
  0% {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(255, 200, 0, 0.6);
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Event card transition */
.event-card.transitioning {
  opacity: 0;
  transform: translateY(20px);
}

.event-card.entering {
  animation: cardEnter 0.3s ease-out forwards;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Event Card */
.event-card {
  border: 3px dashed var(--ink);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  min-height: 200px;
  transition: border-color 0.3s, background 0.3s;
}

.event-card.expense {
  border-color: var(--danger);
  background: #fff5f5;
}

.event-card.opportunity {
  border-color: var(--success);
  background: #f5fff5;
}

.event-card.sabotage {
  border-color: var(--sabotage);
  background: #f9f5f9;
}

.event-card.salary {
  border-color: var(--ink);
  background: #f9f9f9;
}

/* Gambling result cards */
.event-card.gambling-win {
  border-color: #f1c40f;
  background: linear-gradient(135deg, #fffde7 0%, #fff9c4 100%);
  animation: winPulse 0.5s ease-out;
}

.event-card.gambling-loss {
  border-color: #7f8c8d;
  background: linear-gradient(135deg, #ecf0f1 0%, #bdc3c7 100%);
}

@keyframes winPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }

  100% {
    transform: scale(1);
  }
}

.event-type {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  margin-bottom: 12px;
}

.event-card.expense .event-type {
  background: var(--danger);
}

.event-card.opportunity .event-type {
  background: var(--success);
}

.event-card.sabotage .event-type {
  background: var(--sabotage);
}

.event-title {
  margin: 0 0 8px;
  font-size: 20px;
}

.event-description {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.5;
}

/* Character image in event cards */
.event-character-img {
  float: left;
  width: 56px;
  height: 56px;
  margin: 0 12px 8px 0;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid currentColor;
  opacity: 0.9;
}

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-align: left;
}

.choice-btn:hover {
  background: #f0f0f0;
  transform: translateX(4px);
}

.choice-btn:active {
  transform: translateX(2px);
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
  .choice-btn {
    padding: 14px 18px;
    min-height: 48px;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 48px;
  }

  .character-card {
    padding: 18px 14px;
  }
}

.choice-btn.clicked {
  animation: choiceClick 0.3s ease-out;
  pointer-events: none;
}

@keyframes choiceClick {
  0% {
    transform: scale(1);
    background: var(--paper);
  }

  50% {
    transform: scale(0.95);
    background: #e0e0e0;
  }

  100% {
    transform: scale(1);
    background: #d0d0d0;
  }
}

.choice-text {
  flex: 1;
}

.choice-cost {
  font-weight: bold;
  margin-left: 12px;
  white-space: nowrap;
}

.choice-cost.negative {
  color: var(--danger);
}

.choice-cost.positive {
  color: var(--success);
}

.choice-cost.risky {
  color: var(--warning);
}

/* History Section */
.history-section {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed var(--muted);
}

.history-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.history-list {
  max-height: 120px;
  overflow-y: auto;
  font-size: 13px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dotted #ddd;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item .event-name {
  flex: 1;
}

.history-item .event-amount {
  font-weight: bold;
  margin-left: 8px;
}

.history-item .event-amount.positive {
  color: var(--success);
}

.history-item .event-amount.negative {
  color: var(--danger);
}

/* Pause Indicator */
.pause-indicator {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  animation: pulse 1.5s ease-in-out infinite;
}

.pause-indicator.hidden {
  display: none;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* End Screen / Summary */
.summary-container {
  flex: 1;
}

.summary-header {
  text-align: center;
  padding: 24px;
  border: 3px dashed var(--ink);
  border-radius: 16px;
  margin-bottom: 20px;
}

.summary-header.victory {
  border-color: var(--success);
  background: #f0fff0;
}

.summary-header.defeat {
  border-color: var(--danger);
  background: #fff0f0;
}

.summary-header h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.summary-header .verdict {
  font-size: 16px;
  margin: 0;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px;
  background: #f9f9f9;
  border-radius: 12px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: bold;
  display: block;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
}

.summary-timeline {
  margin-bottom: 20px;
}

.summary-timeline h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.timeline-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 12px;
}

.timeline-item {
  padding: 8px 0;
  border-bottom: 1px dotted #ddd;
  font-size: 13px;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-date {
  font-weight: bold;
  color: var(--muted);
  font-size: 11px;
}

.timeline-event {
  margin-top: 4px;
}

.timeline-outcome {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.summary-actions {
  display: flex;
  gap: 12px;
}

.summary-actions button {
  flex: 1;
  width: auto;
  margin: 0;
  padding: 14px 20px;
  font-size: 16px;
}

.btn-secondary {
  padding: 12px 20px;
  font-family: inherit;
  font-size: 16px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #f0f0f0;
}

/* ===============================
   SHAREABLE CARD & CHART STYLES
   =============================== */

.share-card {
  background: linear-gradient(135deg, #fefefe 0%, #f5f5f5 100%);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  margin: 0 auto 20px;
  border: 2px solid var(--ink);
}

.share-card.victory {
  border-color: var(--success);
  background: linear-gradient(135deg, #f0fff0 0%, #e8f5e8 100%);
}

.share-card.victory-dark {
  border-color: var(--sabotage);
  background: linear-gradient(135deg, #f8f0f8 0%, #f0e8f0 100%);
}

.share-card.defeat {
  border-color: var(--danger);
  background: linear-gradient(135deg, #fff5f5 0%, #f8e8e8 100%);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.card-portrait {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.card-title h2 {
  margin: 0;
  font-size: 24px;
  color: var(--ink);
}

.card-title h3 {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: normal;
}

.card-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.card-result.victory {
  background: var(--success);
  color: white;
}

.card-result.victory-dark {
  background: var(--sabotage);
  color: white;
}

.card-result.defeat {
  background: var(--danger);
  color: white;
}

.result-icon {
  font-size: 24px;
}

.result-text {
  font-size: 18px;
  font-weight: bold;
}

.result-time {
  font-size: 14px;
  opacity: 0.9;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.card-narrative {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
}

.card-narrative p {
  margin: 0;
}

.card-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.card-stat {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: white;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.card-stat .stat-value {
  display: block;
  font-size: 18px;
  font-weight: bold;
  color: var(--ink);
}

.card-stat .stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.card-chart {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #ddd;
}

.card-chart h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.timeline-chart {
  width: 100%;
  height: auto;
  display: block;
}

.timeline-chart .chart-label {
  font-size: 10px;
  fill: var(--muted);
  font-family: "Short Stack", "Schoolbell", system-ui, sans-serif;
}

.timeline-chart .chart-legend {
  font-size: 10px;
  fill: var(--ink);
  font-family: "Short Stack", "Schoolbell", system-ui, sans-serif;
}

.timeline-chart .chart-axis-label {
  font-size: 11px;
  fill: var(--muted);
  font-family: "Short Stack", "Schoolbell", system-ui, sans-serif;
}

.timeline-chart .chart-event-label {
  font-size: 9px;
  font-family: "Short Stack", "Schoolbell", system-ui, sans-serif;
  font-weight: bold;
}

.timeline-chart .chart-event-month {
  font-size: 8px;
  fill: var(--muted);
  font-family: "Short Stack", "Schoolbell", system-ui, sans-serif;
}

.chart-events-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  padding: 8px;
  background: #f8f8f8;
  border-radius: 6px;
}

.event-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid #eee;
}

.event-row:last-child {
  border-bottom: none;
}

.event-num {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: white;
  flex-shrink: 0;
}

.event-row.positive .event-num {
  background: var(--success);
}

.event-row.negative .event-num {
  background: var(--danger);
}

.event-row.sabotage .event-num {
  background: var(--sabotage);
}

.event-title {
  flex: 1;
  color: #333;
  line-height: 1.3;
}

.event-month {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}

.chart-marker-num {
  font-family: "Short Stack", "Schoolbell", system-ui, sans-serif;
}

/* Inline chart annotations */
.timeline-chart .chart-annotation {
  font-family: "Short Stack", "Schoolbell", system-ui, sans-serif;
  font-size: 9px;
  font-weight: 500;
  pointer-events: none;
}

/* Legacy event-tag support */
.event-tag {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.event-tag.positive {
  background: #e8f5e9;
  color: var(--success);
}

.event-tag.negative {
  background: #ffebee;
  color: var(--danger);
}

.event-tag.sabotage {
  background: #f3e5f5;
  color: var(--sabotage);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px dashed #ccc;
}

.card-tagline {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.card-url {
  font-size: 12px;
  color: var(--ink);
  font-weight: bold;
}

.chart-error {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}

/* ===============================
   SHARE MODAL
   =============================== */

.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.share-modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.share-modal-content h3 {
  margin: 0 0 20px;
  font-size: 20px;
}

.share-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.share-buttons-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.share-buttons-row .share-btn {
  padding: 14px 8px;
  font-size: 12px;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: white;
  font-size: 13px;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.share-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.share-btn svg {
  width: 28px;
  height: 28px;
}

.share-btn.twitter {
  background: #000;
}

.share-btn.whatsapp {
  background: #25D366;
}

.share-btn.facebook {
  background: #1877F2;
}

.share-btn.copy {
  background: var(--ink);
}

.share-btn.download {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.share-btn.share-native {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.share-btn:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.share-section {
  margin-bottom: 16px;
}

.share-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 0 0 10px;
}

.share-buttons.image-buttons {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 12px;
}

.share-buttons.image-buttons .share-btn {
  padding: 14px 12px;
}

/* 3-column layout for text share buttons */
.share-section:last-of-type .share-buttons {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.share-section:last-of-type .share-btn {
  padding: 12px 8px;
  font-size: 11px;
  gap: 6px;
}

.share-section:last-of-type .share-btn svg {
  width: 22px;
  height: 22px;
}

.share-close {
  width: 100%;
  padding: 12px;
  background: #f0f0f0;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}

.share-close:hover {
  background: #e0e0e0;
}

/* Footer */
footer {
  margin-top: auto;
  padding: 20px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

footer a {
  color: var(--ink);
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.event-card {
  animation: slideIn 0.3s ease-out;
}

/* Tablet adjustments */
@media (max-width: 640px) {
  .share-card {
    padding: 16px;
  }

  .card-stats {
    flex-wrap: wrap;
  }

  .card-stat {
    flex: 1 1 calc(50% - 6px);
    min-width: 100px;
  }

  .card-chart {
    padding: 8px;
  }

  .timeline-chart {
    width: 100%;
  }
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .wrap {
    padding: 12px;
  }

  .intro-card {
    padding: 16px;
  }

  .family-intro {
    padding: 12px;
  }

  .family-member {
    min-width: 60px;
    padding: 6px;
  }

  .money-value {
    font-size: 32px;
  }

  .event-card {
    padding: 16px;
    min-height: 180px;
  }

  .summary-stats {
    grid-template-columns: 1fr;
  }

  .character-select {
    flex-direction: column;
    align-items: center;
  }

  .character-card {
    min-width: unset;
    width: 100%;
    max-width: 280px;
  }

  /* Card mobile styles */
  .share-card {
    padding: 12px;
    border-radius: 12px;
  }

  .card-header {
    gap: 12px;
  }

  .card-portrait {
    width: 48px;
    height: 48px;
  }

  .card-title h2 {
    font-size: 20px;
  }

  .card-result {
    padding: 10px 12px;
    gap: 8px;
  }

  .result-icon {
    font-size: 20px;
  }

  .result-text {
    font-size: 14px;
  }

  .card-stats {
    gap: 8px;
  }

  .card-stat {
    padding: 8px 6px;
    flex: 1 1 calc(33% - 6px);
  }

  .card-stat .stat-value {
    font-size: 14px;
  }

  .card-stat .stat-label {
    font-size: 9px;
  }

  .card-chart {
    padding: 4px;
  }

  .timeline-chart {
    width: 100%;
  }

  .card-footer {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .card-tagline,
  .card-url {
    font-size: 11px;
  }

  /* Status bar mobile */
  .status-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .character-indicator {
    order: -1;
    flex: 1 1 100%;
    justify-content: center;
  }

  .time-display .value {
    font-size: 16px;
  }

  /* Game screen order: status → vitals/bars → event card (choices at bottom) */
  #game-screen .status-bar { order: 1; }
  #game-screen .vitals-section { order: 2; }
  #game-screen .event-card { order: 3; }
  #game-screen .history-section { order: 4; }
  #game-screen .pause-indicator { order: 5; }

  /* Health bars mobile */
  .health-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .health-item {
    flex: 1 1 100%;
  }

  .health-label {
    min-width: 36px;
  }
}

/* Character Selection */
.choose-title {
  text-align: center;
  margin: 20px 0 12px;
  font-size: 18px;
  color: var(--muted);
}

.character-select {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.character-card {
  position: relative;
  flex: 1;
  min-width: 150px;
  max-width: 180px;
  padding: 16px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  background: var(--paper);
}

.character-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.character-card.selected {
  border-color: var(--success);
  background: #f0fff0;
}

.character-card[data-character="chidambaram"] {
  border-color: var(--sabotage);
}

.character-card[data-character="chidambaram"]:hover,
.character-card[data-character="chidambaram"].selected {
  background: #f9f5f9;
}

.character-card[data-character="godavari"] {
  border-color: var(--warning);
}

.character-card[data-character="godavari"]:hover,
.character-card[data-character="godavari"].selected {
  background: #fffaf0;
}

/* Character Portraits */
.char-portrait {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: block;
  margin: 0 auto 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.story-portrait {
  width: 100px;
  height: 100px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.playing-portrait {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  vertical-align: middle;
}

.char-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

.char-name {
  font-size: 16px;
  font-weight: bold;
  display: block;
}

.char-role {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.char-goal {
  font-size: 11px;
  margin: 8px 0;
  line-height: 1.4;
  min-height: 40px;
}

.char-difficulty {
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
}

.diff-stars {
  color: var(--warning);
}

.new-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: white;
  background: var(--danger);
  padding: 2px 10px;
  border-radius: 8px;
  white-space: nowrap;
  animation: blink-badge 1.2s ease-in-out infinite;
  z-index: 1;
}

@keyframes blink-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

/* Character Story Popup */
.character-story {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.character-story.hidden {
  display: none;
}

.story-card {
  background: var(--paper);
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideIn 0.3s ease-out;
}

.story-header {
  text-align: center;
  margin-bottom: 16px;
}

.story-icon {
  font-size: 60px;
  display: block;
}

.story-header h3 {
  margin: 8px 0 0;
  font-size: 24px;
}

.story-content {
  margin-bottom: 16px;
  line-height: 1.6;
}

.story-content p {
  margin: 8px 0;
}

.story-objectives,
.story-defeat {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
}

.story-objectives {
  background: #f0fff0;
  border: 1px solid var(--success);
}

.story-defeat {
  background: #fff0f0;
  border: 1px solid var(--danger);
}

.story-objectives h4,
.story-defeat h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.story-objectives ul,
.story-defeat ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
}

.story-objectives li,
.story-defeat li {
  margin: 4px 0;
}

.story-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.story-actions button {
  flex: 1;
  width: auto;
  margin: 0;
  padding: 14px 20px;
  font-size: 16px;
}

/* Character indicator in game */
.character-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f0f0f0;
  border-radius: 16px;
  font-size: 12px;
}

.playing-icon {
  font-size: 18px;
}

.playing-name {
  font-weight: bold;
}

/* Status bar adjustments for character indicator */
.status-bar {
  justify-content: space-between;
}

/* Target label in vitals */
.target-label {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #ddd;
}

/* Goal reminder */
.goal-reminder {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  padding: 6px;
  background: #f5f5f5;
  border-radius: 8px;
}

.goal-reminder.warning {
  background: #fff3e0;
  color: var(--warning);
}

.goal-reminder.danger {
  background: #ffebee;
  color: var(--danger);
}

.goal-reminder.success {
  background: #e8f5e9;
  color: var(--success);
}