/* Color system */
:root {
  --bg-main: #050816;
  --bg-elevated: #0b1020;
  --bg-soft: rgba(255, 255, 255, 0.03);
  --accent: #4adeff;
  --accent-soft: rgba(74, 222, 255, 0.12);
  --accent-strong: #22c55e;
  --danger: #fb7185;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border-subtle: rgba(148, 163, 184, 0.3);
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.9);
  --radius-lg: 18px;
  --radius-pill: 999px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 0% 0%, #22c55e22 0, transparent 55%),
    radial-gradient(circle at 100% 100%, #4adeff22 0, transparent 55%),
    var(--bg-main);
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px 12px calc(env(safe-area-inset-bottom, 0) + 12px);
  gap: 12px;
}

.app-main {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

.screen {
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  gap: 10px;
}

.screen-active {
  display: flex;
}

.screen-fullscreen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(circle at 0 0, #22c55e11, transparent 50%),
    radial-gradient(circle at 100% 100%, #4adeff11, transparent 50%),
    rgba(5, 8, 22, 0.96);
  backdrop-filter: blur(20px);
}

.hidden {
  display: none !important;
}

.loader-orb {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: #4adeff;
  border-right-color: #22c55e;
  animation: spin 1.1s linear infinite;
  box-shadow: 0 0 32px rgba(56, 189, 248, 0.5);
}

.loader-text {
  font-size: 14px;
  color: var(--text-muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-card {
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(248, 250, 252, 0.1);
  box-shadow: var(--shadow-soft);
  max-width: 320px;
  text-align: center;
}

.error-icon {
  font-size: 26px;
}

.error-title {
  margin-top: 8px;
  font-weight: 600;
}

.error-text {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.app-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px 6px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: var(--shadow-soft);
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 999px;
}

.nav-item-active {
  background: var(--accent-soft);
  color: var(--text-main);
}

.nav-icon {
  font-size: 16px;
}

.nav-label {
  font-size: 11px;
}

.btn {
  border-radius: var(--radius-pill);
  border: none;
  padding: 9px 14px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #4adeff, #22c55e);
  color: #020617;
  box-shadow: 0 10px 32px rgba(16, 185, 129, 0.6);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.5);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.surface {
  border-radius: 20px;
  padding: 14px 14px 12px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.82));
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: var(--shadow-soft);
}

.surface-soft {
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(51, 65, 85, 0.8);
}

.surface-glow {
  border-radius: 20px;
  padding: 12px;
  background: radial-gradient(circle at 0 0, #4adeff1f, transparent 55%),
    radial-gradient(circle at 100% 100%, #22c55e1f, transparent 55%),
    rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.9);
}

.surface-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.surface-title {
  font-size: 14px;
  font-weight: 600;
}

.surface-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.char-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr 0.9fr;
  gap: 10px;
  align-items: center;
}

.char-gear-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gear-slot {
  border-radius: 14px;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.9);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gear-slot-label {
  color: var(--text-muted);
}

.gear-slot-value {
  font-weight: 500;
}

.gear-slot-empty .gear-slot-value {
  opacity: 0.6;
}

.char-avatar {
  border-radius: 18px;
  padding: 12px;
  background: radial-gradient(circle at 0 0, #22c55e33, transparent 55%),
    radial-gradient(circle at 100% 100%, #4adeff33, transparent 55%),
    rgba(15, 23, 42, 0.92);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.char-name {
  margin-top: 6px;
  font-weight: 600;
}

.char-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.char-resources {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  font-size: 11px;
}

.char-res-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.pigeon-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.pigeon-art {
  border-radius: 18px;
  padding: 10px;
  background: radial-gradient(circle at 0 0, #22c55e33, transparent 55%),
    radial-gradient(circle at 100% 100%, #4adeff33, transparent 55%),
    rgba(15, 23, 42, 0.92);
  position: relative;
  overflow: hidden;
}

.pigeon-emoji {
  font-size: 40px;
  display: inline-block;
  filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.8));
}

.pigeon-name {
  margin-top: 6px;
  font-weight: 600;
}

.pigeon-level {
  font-size: 11px;
  color: var(--text-muted);
}

.pigeon-tagline {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 11px;
  color: rgba(226, 232, 240, 0.8);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.stat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.stat-label-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.stat-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transform-origin: left center;
  transition: transform 0.3s ease;
}

.stat-bar-fill.low {
  background: linear-gradient(90deg, #fb7185, #f97316);
}

.quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.quick-actions .btn {
  flex: 1;
  font-size: 13px;
}

.work-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.work-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.work-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.work-title {
  font-size: 14px;
  font-weight: 600;
}

.work-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.chip-soft {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(55, 65, 81, 0.9);
}

.inventory-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.inventory-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
}

.inventory-tab-active {
  border-color: #4adeff;
  color: var(--text-main);
  background: radial-gradient(circle at 0 0, #22c55e33, transparent 60%),
    rgba(15, 23, 42, 0.95);
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.inventory-item {
  border-radius: 14px;
  padding: 8px 6px 7px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(51, 65, 85, 0.9);
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.inventory-item-title {
  font-size: 11px;
}

.inventory-item-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.inventory-empty {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.quests-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quest-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quest-title {
  font-size: 13px;
  font-weight: 500;
}

.quest-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.quest-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
}

.quest-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f97316, #facc15);
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-field {
  width: 100%;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(55, 65, 81, 0.9);
  color: var(--text-main);
  font-size: 14px;
}

.input-field::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

.help-text {
  font-size: 11px;
  color: var(--text-muted);
}

#toast-container {
  position: fixed;
  inset-inline: 0;
  bottom: calc(env(safe-area-inset-bottom, 0) + 80px);
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 13px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text-main);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.95);
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.7);
}

.toast-error {
  border-color: rgba(248, 113, 113, 0.8);
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4ade80;
}

.toast-dot.error {
  background: #fb7185;
}

.pill-danger {
  border-color: rgba(248, 113, 113, 0.8);
  color: #fecaca;
}

.pill-success {
  border-color: rgba(34, 197, 94, 0.8);
  color: #bbf7d0;
}

@media (max-width: 400px) {
  .char-layout {
    grid-template-columns: 1fr;
  }
}

