/* Base layout, shell, typography, cards, and Home Quick-Start styles */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}

body.is-focusing {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* App Shell */

/* Navigation: Bottom bar on mobile, sticky top bar on desktop */

/* Shared Cards & Typography */

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.panel-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.sub-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin: 14px 0 8px;
}

.card-desc {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.empty-note {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--ink-3);
}

/* Shared Buttons */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: var(--accent);
  color: #fffcf8;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(200, 106, 58, 0.28);
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.985);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary.btn-sm {
  padding: 10px 15px;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 14.5px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-soft);
}

.btn-secondary-sm {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.btn-secondary-sm:hover {
  background: var(--bg-soft);
}

.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-ghost-sm {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost-sm:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* Home View */

.home-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-card {
  background: #3b3028;
  color: #fffaf3;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-ko {
  font-weight: 600;
  font-size: 14px;
  color: rgba(255, 245, 232, 0.78);
}

.brand-sub {
  font-size: 12px;
  color: rgba(255, 245, 232, 0.68);
}

.pill-bottle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 244, 224, 0.28);
  background: rgba(255, 245, 232, 0.14);
  color: #fff9ef;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px 6px 8px;
  border-radius: var(--radius-pill);
}

.pill-bottle:hover {
  background: rgba(255, 245, 232, 0.22);
}

.hero-copy {
  margin: 16px 0 16px;
  font-size: clamp(21px, 4.6vw, 29px);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.03em;
}

.hero-stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hero-stats-strip.hero-stats-4 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 600px) {
  .hero-stats-strip.hero-stats-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-val.gold {
  color: #f7c768;
}

.stat-chip {
  text-align: left;
  border: 1px solid rgba(255, 245, 232, 0.16);
  background: rgba(255, 245, 232, 0.09);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

button.stat-chip:hover {
  background: rgba(255, 245, 232, 0.15);
}

.stat-label {
  font-size: 12px;
  color: rgba(255, 245, 232, 0.72);
}

.stat-val {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.stat-val.accent {
  color: #ffd98e;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 820px) {
  .home-grid {
    grid-template-columns: 1.05fr 1fr;
    align-items: start;
  }
}

.pet-stage-preview {
  position: relative;
  height: 186px;
  border-radius: var(--radius-md);
  background-size: cover;
  background-position: center 62%;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border: 1px solid var(--border);
}

.pet-stage-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(25, 19, 14, 0.1) 0%, rgba(25, 19, 14, 0.34) 100%);
}

.pet-preview-canvas {
  position: relative;
  z-index: 2;
  width: 150px;
  height: 150px;
}

.seat-preview-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(26, 20, 15, 0.62);
  color: #fffaf2;
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
}

.species-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.species-row.species-row-5 {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 6px;
}

@media (min-width: 520px) {
  .species-row.species-row-5 {
    grid-template-columns: repeat(5, 1fr);
  }
}

.family-sub-note {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.family-slots-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.family-slots-row.is-4-cols {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 520px) {
  .family-slots-row.is-4-cols {
    grid-template-columns: repeat(4, 1fr);
  }
}

.family-slot-btn.is-foster {
  border-color: #d6a45b;
  background: #fdf6e8;
}

.foster-status-banner {
  margin-bottom: 12px;
  padding: 11px 13px;
  background: var(--gold-soft);
  border: 1px solid #e5cb8d;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.foster-status-banner div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #6b4b12;
  flex: 1;
}

.snack-action-row {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--sage-soft);
  border: 1px solid #c3dfd0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.snack-action-row div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
  color: #255040;
}

.snack-action-row strong {
  font-size: 13px;
}

.personality-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

@media (min-width: 480px) {
  .personality-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

.pers-btn {
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

.pers-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.family-slot-btn {
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 7px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  min-width: 0;
  transition: all 0.14s ease;
}

.family-slot-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.family-slot-btn.is-locked {
  border-style: dashed;
  background: var(--surface);
  color: var(--ink-2);
}

.family-slot-btn.is-locked.can-unlock {
  border-color: var(--sage);
  background: var(--sage-soft);
  color: var(--sage);
}

.family-slot-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.slot-lock-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--bg-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.family-slot-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.family-slot-txt strong {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.family-slot-txt span {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.promote-leader-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  border: 1px solid rgba(255, 245, 232, 0.36);
  background: rgba(28, 21, 16, 0.68);
  color: #fffaf2;
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
}

.pet-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.pet-name-row input {
  width: 145px;
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
}

.size-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.size-btn {
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.size-btn strong {
  font-size: 12px;
  font-weight: 750;
}

.size-btn span {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
}

.size-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.size-btn.is-active span {
  color: var(--accent);
}

.collar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.species-btn {
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  transition: all 0.14s ease;
}

.species-btn img {
  object-fit: contain;
}

.species-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.coat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.coat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 6px 11px 6px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.coat-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.coat-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(40, 30, 20, 0.22);
  flex-shrink: 0;
}

/* Duration & Setup */

.duration-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.dur-btn {
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.dur-btn strong {
  font-size: 16px;
  font-weight: 700;
}

.dur-btn span {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
}

.dur-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dur-btn.is-active strong,
.dur-btn.is-active span {
  color: var(--accent);
}

.custom-dur-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.custom-dur-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-dur-input-wrap input {
  width: 72px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 700;
  text-align: right;
}

.seat-mini-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.seat-mini-btn {
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 9px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.seat-mini-name {
  font-size: 12.5px;
  font-weight: 700;
}

.seat-mini-badge {
  font-size: 12px;
  color: var(--ink-3);
}

.seat-mini-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.seat-mini-btn.is-active .seat-mini-badge {
  color: var(--accent);
}

.toggle-row {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.toggle-title {
  font-size: 13.5px;
  font-weight: 700;
}

.toggle-desc {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.switch-input {
  appearance: none;
  width: 44px;
  height: 26px;
  background: var(--border-strong);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.16s ease;
  cursor: pointer;
}

.switch-input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.16s ease;
}

.switch-input:checked {
  background: var(--accent);
}

.switch-input:checked::after {
  transform: translateX(18px);
}

.start-summary {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 0 4px;
}

.start-summary strong {
  color: var(--sage);
  font-size: 16px;
}

.btn-start-focus {
  width: 100%;
  margin-top: 10px;
  padding: 16px 20px;
  font-size: 16px;
  flex-direction: column;
  gap: 2px;
}

.btn-sub-hint {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.86;
}

.home-quick-links {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Inline Inputs */

/* Toast */

.nr-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 18px);
  transform: translate(-50%, 16px);
  z-index: 200;
  background: rgba(91, 67, 52, 0.96);
  color: #fffaf3;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(92vw, 440px);
  text-align: center;
}

.nr-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.is-focusing .nr-toast {
  bottom: auto;
  top: calc(60px + var(--safe-t));
}

/* Demo Mode Toolbar (?demo=1 only)
 * Cleanly avoids overlapping top HUD buttons on narrow 375px portrait & landscape focus screens.
 */

.demo-bar {
  position: fixed;
  right: 12px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  z-index: 180;
  background: rgba(28, 24, 22, 0.9);
  color: #fff8ef;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 225, 175, 0.26);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  max-width: min(320px, calc(100vw - 24px));
}

.demo-bar.is-collapsed {
  padding: 6px 10px;
  border-radius: 999px;
}

body.is-focusing .demo-bar {
  bottom: auto;
  right: auto;
  left: calc(12px + env(safe-area-inset-left, 0px));
  top: calc(88px + env(safe-area-inset-top, 0px));
  z-index: 110;
}

@media (max-width: 440px) {
  body.is-focusing .demo-bar {
    top: calc(94px + env(safe-area-inset-top, 0px));
  }
}

.demo-bar-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-badge {
  background: #f5b951;
  color: #241910;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.demo-title {
  font-size: 12px;
  font-weight: 700;
  flex: 1;
}

.demo-toggle-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #fff;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 8px;
}

.demo-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.demo-btn {
  border: 1px solid rgba(255, 232, 198, 0.24);
  background: rgba(255, 244, 226, 0.12);
  color: #fffaf2;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 8px;
}

.demo-btn:hover {
  background: rgba(255, 244, 226, 0.22);
}
