:root {
  color-scheme: light;
  --bg: #fff8ec;
  --body-start: #fff8ec;
  --body-end: #edf9ff;
  --panel: #fffaf1;
  --card-bg: rgba(255, 250, 241, 0.92);
  --choice-bg: rgba(255, 255, 255, 0.82);
  --field-bg: #fff;
  --input-border: rgba(81, 104, 244, 0.28);
  --ink: #2b251d;
  --muted: #6c6256;
  --primary: #5168f4;
  --primary-dark: #2e3fb4;
  --primary-soft: rgba(81, 104, 244, 0.14);
  --primary-wash: rgba(81, 104, 244, 0.07);
  --primary-border: rgba(81, 104, 244, 0.28);
  --selected-shadow: rgba(81, 104, 244, 0.2);
  --secondary: #f7a94b;
  --secondary-soft: rgba(247, 169, 75, 0.22);
  --share-bg: rgba(247, 169, 75, 0.16);
  --green: #52c06d;
  --green-soft: rgba(82, 192, 109, 0.18);
  --danger: #d94c45;
  --shadow: 0 18px 40px rgba(43, 37, 29, 0.12);
}

body[data-theme="theme-ocean"] {
  --body-start: #e6fbff;
  --body-end: #d8f3ef;
  --card-bg: rgba(240, 253, 255, 0.94);
  --choice-bg: rgba(255, 255, 255, 0.86);
  --field-bg: #f8feff;
  --input-border: rgba(20, 122, 159, 0.28);
  --ink: #12313c;
  --muted: #526f78;
  --primary: #147a9f;
  --primary-dark: #0f5d7a;
  --primary-soft: rgba(20, 122, 159, 0.14);
  --primary-wash: rgba(20, 122, 159, 0.08);
  --primary-border: rgba(20, 122, 159, 0.3);
  --selected-shadow: rgba(20, 122, 159, 0.22);
  --secondary: #2ec4b6;
  --secondary-soft: rgba(46, 196, 182, 0.22);
  --share-bg: rgba(46, 196, 182, 0.16);
  --green: #22a06b;
  --green-soft: rgba(34, 160, 107, 0.18);
  --danger: #e14d6f;
}

body[data-theme="theme-space"] {
  color-scheme: dark;
  --body-start: #0f172a;
  --body-end: #312e81;
  --card-bg: rgba(17, 24, 39, 0.9);
  --choice-bg: rgba(30, 41, 59, 0.88);
  --field-bg: #111827;
  --input-border: rgba(124, 58, 237, 0.42);
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --primary: #8b5cf6;
  --primary-dark: #c4b5fd;
  --primary-soft: rgba(139, 92, 246, 0.24);
  --primary-wash: rgba(139, 92, 246, 0.16);
  --primary-border: rgba(139, 92, 246, 0.42);
  --selected-shadow: rgba(139, 92, 246, 0.3);
  --secondary: #facc15;
  --secondary-soft: rgba(250, 204, 21, 0.22);
  --share-bg: rgba(250, 204, 21, 0.16);
  --green: #38bdf8;
  --green-soft: rgba(56, 189, 248, 0.2);
  --danger: #fb7185;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.26);
}

body[data-theme="theme-candy"] {
  --body-start: #fff1f8;
  --body-end: #dcfce7;
  --card-bg: rgba(255, 247, 253, 0.94);
  --choice-bg: rgba(255, 255, 255, 0.86);
  --field-bg: #fff;
  --input-border: rgba(236, 72, 153, 0.28);
  --ink: #402034;
  --muted: #7a5a70;
  --primary: #ec4899;
  --primary-dark: #be185d;
  --primary-soft: rgba(236, 72, 153, 0.14);
  --primary-wash: rgba(236, 72, 153, 0.08);
  --primary-border: rgba(236, 72, 153, 0.3);
  --selected-shadow: rgba(236, 72, 153, 0.22);
  --secondary: #8b5cf6;
  --secondary-soft: rgba(139, 92, 246, 0.2);
  --share-bg: rgba(94, 234, 212, 0.24);
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.18);
  --danger: #f43f5e;
}

body[data-theme="theme-forest"] {
  --body-start: #f3f7e8;
  --body-end: #d9ead3;
  --card-bg: rgba(252, 250, 237, 0.94);
  --choice-bg: rgba(255, 255, 248, 0.86);
  --field-bg: #fffdf2;
  --input-border: rgba(47, 111, 62, 0.28);
  --ink: #21351f;
  --muted: #63705a;
  --primary: #2f6f3e;
  --primary-dark: #1f5130;
  --primary-soft: rgba(47, 111, 62, 0.14);
  --primary-wash: rgba(47, 111, 62, 0.08);
  --primary-border: rgba(47, 111, 62, 0.3);
  --selected-shadow: rgba(47, 111, 62, 0.22);
  --secondary: #9a6b34;
  --secondary-soft: rgba(154, 107, 52, 0.22);
  --share-bg: rgba(132, 204, 22, 0.18);
  --green: #65a30d;
  --green-soft: rgba(101, 163, 13, 0.18);
  --danger: #b45309;
}

body[data-theme="theme-volcano"] {
  color-scheme: dark;
  --body-start: #1f1f24;
  --body-end: #451a03;
  --card-bg: rgba(38, 38, 42, 0.92);
  --choice-bg: rgba(55, 55, 60, 0.88);
  --field-bg: #2a2a2f;
  --input-border: rgba(249, 115, 22, 0.4);
  --ink: #fff7ed;
  --muted: #fed7aa;
  --primary: #f97316;
  --primary-dark: #fdba74;
  --primary-soft: rgba(249, 115, 22, 0.22);
  --primary-wash: rgba(249, 115, 22, 0.16);
  --primary-border: rgba(249, 115, 22, 0.4);
  --selected-shadow: rgba(249, 115, 22, 0.3);
  --secondary: #ef4444;
  --secondary-soft: rgba(239, 68, 68, 0.24);
  --share-bg: rgba(239, 68, 68, 0.18);
  --green: #facc15;
  --green-soft: rgba(250, 204, 21, 0.18);
  --danger: #fb7185;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

body[data-theme="theme-arctic"] {
  --body-start: #f0fbff;
  --body-end: #dbeafe;
  --card-bg: rgba(255, 255, 255, 0.94);
  --choice-bg: rgba(248, 253, 255, 0.9);
  --field-bg: #ffffff;
  --input-border: rgba(2, 132, 199, 0.28);
  --ink: #0f172a;
  --muted: #475569;
  --primary: #0284c7;
  --primary-dark: #075985;
  --primary-soft: rgba(2, 132, 199, 0.14);
  --primary-wash: rgba(2, 132, 199, 0.08);
  --primary-border: rgba(2, 132, 199, 0.3);
  --selected-shadow: rgba(2, 132, 199, 0.22);
  --secondary: #38bdf8;
  --secondary-soft: rgba(56, 189, 248, 0.22);
  --share-bg: rgba(186, 230, 253, 0.34);
  --green: #0d9488;
  --green-soft: rgba(13, 148, 136, 0.18);
  --danger: #dc2626;
}

body[data-theme="theme-sunset"] {
  --body-start: #fff0d6;
  --body-end: #e0e7ff;
  --card-bg: rgba(255, 247, 237, 0.94);
  --choice-bg: rgba(255, 255, 255, 0.86);
  --field-bg: #fffaf5;
  --input-border: rgba(219, 39, 119, 0.28);
  --ink: #332040;
  --muted: #725c79;
  --primary: #db2777;
  --primary-dark: #9d174d;
  --primary-soft: rgba(219, 39, 119, 0.14);
  --primary-wash: rgba(219, 39, 119, 0.08);
  --primary-border: rgba(219, 39, 119, 0.3);
  --selected-shadow: rgba(219, 39, 119, 0.22);
  --secondary: #4338ca;
  --secondary-soft: rgba(67, 56, 202, 0.18);
  --share-bg: rgba(251, 146, 60, 0.2);
  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.18);
  --danger: #e11d48;
}

body[data-theme="theme-royal"] {
  --body-start: #fff7db;
  --body-end: #ede9fe;
  --card-bg: rgba(255, 251, 235, 0.94);
  --choice-bg: rgba(255, 255, 255, 0.86);
  --field-bg: #fffdf5;
  --input-border: rgba(109, 40, 217, 0.28);
  --ink: #2e1747;
  --muted: #6d5b7c;
  --primary: #6d28d9;
  --primary-dark: #4c1d95;
  --primary-soft: rgba(109, 40, 217, 0.14);
  --primary-wash: rgba(109, 40, 217, 0.08);
  --primary-border: rgba(109, 40, 217, 0.3);
  --selected-shadow: rgba(109, 40, 217, 0.22);
  --secondary: #d9a82c;
  --secondary-soft: rgba(217, 168, 44, 0.24);
  --share-bg: rgba(244, 197, 66, 0.2);
  --green: #15803d;
  --green-soft: rgba(21, 128, 61, 0.18);
  --danger: #be123c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--body-start) 0%, var(--body-end) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
  position: relative;
}

.app-toolbar {
  position: fixed;
  top: 1rem;
  right: max(1rem, calc((100vw - 1180px) / 2 + 1rem));
  z-index: 30;
}

.menu-button {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--primary-dark);
  font-size: 1.45rem;
  line-height: 1;
  box-shadow: var(--shadow);
  border: 2px solid var(--primary-border);
}

.settings-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 220px;
  padding: 0.65rem;
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  border: 2px solid var(--primary-border);
  display: grid;
  gap: 0.35rem;
}

.settings-menu .auth-status {
  padding: 0.35rem 0.55rem 0.55rem;
  border-bottom: 1px solid var(--primary-border);
  margin-bottom: 0.15rem;
  word-break: break-word;
}

.settings-menu button {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.settings-menu button:hover,
.settings-menu button:focus-visible {
  background: var(--field-bg);
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(20, 35, 45, 0.45);
}

.settings-panel {
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  overflow: auto;
  margin: 0;
}

.settings-panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.settings-panel-topline h2 {
  margin: 0;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.history-item,
.history-empty {
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  background: var(--field-bg);
  border: 1px solid var(--primary-border);
}

.history-item {
  display: grid;
  gap: 0.35rem;
}

.history-item strong {
  display: block;
}

.history-item span {
  color: var(--muted);
  font-size: 0.88rem;
}

.history-empty {
  color: var(--muted);
  font-weight: 700;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 1.2rem;
  width: min(920px, 100%);
  align-items: center;
}

.card {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 28px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
}

.dashboard .dog-card {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.hero.hero-solo {
  grid-template-columns: 1fr;
}

.hero h1,
.card h2,
.card h3 {
  margin: 0.2rem 0 0.6rem;
}

.hero-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-setup {
  display: grid;
  gap: 0.45rem;
}

.profile-row,
.auth-form,
.answer-form {
  display: grid;
  gap: 0.5rem;
}

.profile-row,
.answer-form {
  grid-template-columns: 1fr auto;
}

.auth-form {
  grid-template-columns: 1fr;
}

input {
  min-width: 0;
  padding: 0.8rem;
  border: 2px solid var(--input-border);
  border-radius: 14px;
  background: var(--field-bg);
  color: var(--ink);
}

textarea {
  width: 100%;
  min-height: 5rem;
  padding: 0.8rem;
  border: 2px solid var(--input-border);
  border-radius: 14px;
  background: var(--field-bg);
  color: var(--ink);
  resize: vertical;
}

.profile-row button,
.auth-actions button,
.answer-form button,
.primary-action,
.secondary-action,
.shop-button {
  padding: 0.82rem 1rem;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.secondary-action,
.shop-button.secondary {
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.auth-message,
.auth-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-message.error {
  color: var(--danger);
}

.auth-message.good {
  color: var(--green);
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.dog-card {
  text-align: center;
}

.stats-section {
  margin-top: 1rem;
  text-align: center;
}

.stats-section h2 {
  margin-bottom: 0.75rem;
}

.dog-yard {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(180deg, #ccefff 0%, #d8f3c3 62%, #b7df86 100%);
}

.yard-art {
  position: absolute;
}

.yard-art svg,
.yard-art img {
  display: block;
  width: 100%;
  height: auto;
}

.layer-bg {
  inset: 0;
}

.layer-bg svg {
  width: 100%;
  height: 100%;
}

.layer-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.layer-scenery-accent svg,
.layer-scenery-accent img {
  display: block;
  width: 100%;
  height: auto;
}

.layer-sky {
  left: 52%;
  top: 5%;
  width: 28%;
  z-index: 1;
  opacity: 0.95;
}

.layer-house {
  left: 5%;
  bottom: 8%;
  width: 30%;
  z-index: 2;
}

.layer-friend {
  left: 17%;
  bottom: 4%;
  width: 17%;
  z-index: 3;
}

.layer-dog {
  left: 38%;
  bottom: 5%;
  width: 25%;
  z-index: 4;
}

.layer-collar {
  left: 41.25%;
  bottom: 13.5%;
  width: 18.5%;
  z-index: 5;
}

.layer-bowl {
  right: 12%;
  bottom: 6%;
  width: 17%;
  z-index: 6;
}

.layer-food {
  right: 2%;
  bottom: 8%;
  width: 13%;
  z-index: 6;
}

.layer-toy {
  left: 31%;
  bottom: 3%;
  width: 10%;
  z-index: 6;
}

.dog-house {
  position: absolute;
  right: 17%;
  bottom: 87px;
  width: 130px;
  height: 112px;
  border: 6px solid #8d412e;
  border-radius: 18px 18px 8px 8px;
  background: #d46b48;
}

.dog-house::before {
  content: "";
  position: absolute;
  top: -54px;
  left: -18px;
  width: 154px;
  height: 78px;
  clip-path: polygon(50% 0, 100% 70%, 0 70%);
  background: #7d5be7;
}

.dog-house.fancy {
  background: #5fb7ee;
  border-color: #2b5f8a;
}

.dog-house.castle {
  background: #c0a2ff;
  border-color: #5940a0;
}

.dog {
  position: absolute;
  left: 22%;
  bottom: 50px;
  width: 240px;
  height: 210px;
}

.dog-body {
  position: absolute;
  left: 70px;
  bottom: 0;
  width: 150px;
  height: 104px;
  border: 6px solid #6a3f22;
  border-radius: 52% 48% 42% 44%;
  background: #c57a3f;
}

.dog-head {
  position: absolute;
  left: 28px;
  top: 20px;
  width: 118px;
  height: 100px;
  border: 6px solid #6a3f22;
  border-radius: 52% 48% 48% 44%;
  background: #d9944f;
  z-index: 2;
}

.dog-ear {
  position: absolute;
  top: 35px;
  width: 38px;
  height: 66px;
  border-radius: 50%;
  background: #744523;
  z-index: 3;
}

.dog-ear.left {
  left: 16px;
  transform: rotate(20deg);
}

.dog-ear.right {
  left: 124px;
  transform: rotate(-22deg);
}

.dog-eye,
.dog-nose {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: #20140d;
}

.dog-eye {
  top: 40px;
  width: 12px;
  height: 12px;
}

.dog-eye.left {
  left: 42px;
}

.dog-eye.right {
  left: 78px;
}

.dog-nose {
  left: 56px;
  top: 62px;
  width: 22px;
  height: 16px;
}

.dog-collar {
  position: absolute;
  left: 62px;
  top: 116px;
  width: 98px;
  height: 18px;
  border: 3px solid #24327d;
  border-radius: 999px;
  background: #5168f4;
  z-index: 4;
}

.dog-collar.lightning {
  background: #f7df4b;
  border-color: #9b7a00;
}

.dog-collar.champion {
  background: #e94d8a;
  border-color: #8a214b;
}

.dog-bowl {
  position: absolute;
  right: 22%;
  bottom: 42px;
  width: 86px;
  height: 42px;
  border: 5px solid #9b6424;
  border-radius: 0 0 38px 38px;
  background: #f7a94b;
}

.dog-bowl.star {
  background: #ffd85a;
}

.dog-bowl.diamond {
  background: #8de8ff;
}

.dog-food {
  position: absolute;
  right: calc(22% + 18px);
  bottom: 84px;
  font-size: 1.8rem;
}

.equipped-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.equipped-list span {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--primary-soft);
  font-size: 0.85rem;
  font-weight: 700;
}

.postcard-trigger {
  margin-top: 0.9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.stat-grid div {
  padding: 0.9rem;
  border-radius: 18px;
  background: var(--choice-bg);
}

.stat-grid strong {
  display: block;
  font-size: 2rem;
}

.stat-grid span {
  color: var(--muted);
  font-size: 0.9rem;
}

.mode-grid,
.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  width: 100%;
}

.timer-choice,
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.setup-panel {
  width: 100%;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--primary-border);
  text-align: left;
}

.setup-columns {
  display: block;
  width: 100%;
}

.setup-column {
  min-width: 0;
  width: 100%;
}

.setup-column + .setup-column {
  margin-top: 0.25rem;
}

.setup-column h2,
.setup-column h3 {
  margin-top: 0;
}

.choice-card,
.shop-item,
.match-card {
  padding: 1rem;
  border: 2px solid transparent;
  border-radius: 20px;
  background: var(--choice-bg);
  color: var(--ink);
  text-align: left;
}

.choice-card {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  box-sizing: border-box;
}

.choice-card.selected {
  border-color: var(--primary);
  box-shadow: 0 10px 24px var(--selected-shadow);
}

.choice-card strong,
.shop-item strong {
  font-size: 1.05rem;
}

.choice-card span,
.shop-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.streak-options {
  margin: 0.75rem 0 1rem;
  padding: 0.9rem;
  border: 2px dashed var(--primary-border);
  border-radius: 22px;
  background: var(--primary-wash);
}

.streak-options h3,
.streak-options p,
.share-card h3,
.share-card p {
  margin: 0.2rem 0 0.6rem;
}

.share-card {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 22px;
  background: var(--share-bg);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.primary-action {
  width: 100%;
}

.app-shell:has(#playView:not(.hidden)) {
  padding-top: 0.25rem;
}

.app-shell:has(#playView:not(.hidden)) .game-card {
  margin-top: 0.25rem;
  padding-top: 0.65rem;
  padding-right: 3.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-header {
  margin-bottom: 0.35rem;
}

.game-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.game-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.game-meta .progress-text {
  margin: 0;
}

.game-timer {
  align-self: flex-start;
  margin-top: 0.15rem;
  padding: 0.35rem 0.65rem;
  font-size: 1rem;
}

.game-card {
  display: flex;
  flex-direction: column;
}

.game-buddy {
  margin: 0;
  flex-shrink: 0;
}

.game-buddy .game-companion {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.game-buddy .companion-stage {
  width: clamp(3.5rem, 16vw, 4.75rem);
}

.game-buddy .companion-accessories {
  flex-direction: column;
  gap: 0.2rem;
}

.game-buddy .companion-accessory {
  width: clamp(1.25rem, 6vw, 1.6rem);
}

.game-companion {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-height: 0;
}

.companion-stage {
  position: relative;
  width: clamp(5rem, 22vw, 7rem);
  aspect-ratio: 1;
}

.companion-dog,
.companion-collar {
  position: absolute;
  inset: 0;
}

.companion-dog svg,
.companion-dog img,
.companion-collar svg,
.companion-collar img {
  display: block;
  width: 100%;
  height: 100%;
}

.companion-collar {
  z-index: 1;
  transform: translateY(8%) scale(0.92);
  transform-origin: center bottom;
  pointer-events: none;
}

.companion-accessories {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.companion-accessory {
  display: block;
  width: clamp(1.75rem, 8vw, 2.25rem);
}

.companion-accessory svg,
.companion-accessory img {
  display: block;
  width: 100%;
  height: auto;
}

.timer-pill {
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 900;
}

.progress-text {
  color: var(--muted);
  font-weight: 700;
}

.equation {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(3rem, 14vw, 6rem);
  font-weight: 900;
  text-align: center;
}

.answer-form {
  max-width: 360px;
  margin: 0 auto;
}

.feedback {
  min-height: 1.5rem;
  font-weight: 800;
  text-align: center;
}

.feedback.good {
  color: #23803d;
}

.feedback.bad {
  color: var(--danger);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.matching-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 1rem;
}

.match-column {
  display: grid;
  gap: 0.55rem;
}

.match-card {
  cursor: pointer;
  font-weight: 800;
  text-align: center;
}

.match-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.match-card.matched {
  border-color: var(--green);
  background: var(--green-soft);
}

.shop-item {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.shop-item > div {
  min-width: 0;
}

.shop-item strong,
.shop-item p {
  overflow-wrap: anywhere;
}

.store-page {
  width: 100%;
}

.store-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.store-topline h2 {
  margin: 0;
}

.store-coins {
  margin: 0 0 1rem;
  font-weight: 700;
  color: var(--muted);
}

.store-coins strong {
  color: var(--ink);
  font-size: 1.35rem;
}

.store-yard {
  margin-bottom: 1rem;
}

.store-equipped {
  margin-bottom: 1rem;
  text-align: center;
}

.store-equipped h3 {
  margin: 0 0 0.65rem;
}

.store-copy {
  margin: 0 0 1rem;
  color: var(--muted);
}

.shop-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;
  padding: 0.5rem;
  border-radius: 14px;
  background: var(--primary-wash);
  overflow: hidden;
}

.shop-preview-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.shop-preview-art svg,
.shop-preview-art img,
.shop-preview svg,
.shop-preview img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 76px;
  object-fit: contain;
}

.theme-swatch {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  width: 100%;
  height: 100%;
}

.theme-swatch span {
  min-height: 76px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.shop-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
}

.shop-meta .shop-button {
  white-space: nowrap;
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
}

.coin-pill {
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  background: var(--secondary-soft);
  font-weight: 800;
}

.postcard-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.postcard-print-area {
  display: grid;
  place-items: center;
  margin: 1rem 0;
}

.postcard-front {
  position: relative;
  width: min(100%, 850px);
  aspect-ratio: 7 / 5;
  overflow: hidden;
  border: 10px solid var(--field-bg);
  border-radius: 24px;
  background: var(--body-end);
  box-shadow: var(--shadow);
}

.postcard-copy {
  position: absolute;
  left: 4%;
  top: 5%;
  z-index: 10;
  max-width: 48%;
  padding: 0.85rem;
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 10px 24px var(--selected-shadow);
}

.postcard-copy h2,
.postcard-copy p {
  margin: 0.2rem 0;
}

.postcard-yard {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #ccefff 0%, #d8f3c3 62%, #b7df86 100%);
}

.postcard-actions {
  display: flex;
  justify-content: center;
}

.site-footer {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer hr {
  border: 0;
  border-top: 2px solid var(--primary-border);
  margin: 0 0 0.85rem;
}

.site-footer p {
  margin: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .hero,
  .auth-card,
  .dashboard,
  .matching-board {
    grid-template-columns: 1fr;
  }

  .app-toolbar {
    right: 1rem;
  }

  .settings-panel-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .store-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .dog {
    left: 8%;
  }

  .dog-house {
    right: 8%;
  }

  .dog-bowl {
    right: 12%;
  }

  .profile-row,
  .answer-form {
    grid-template-columns: 1fr;
  }

  .setup-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 0.65rem;
  }

  .setup-column {
    min-width: 0;
  }

  .setup-column + .setup-column {
    margin-top: 0;
  }

  .setup-column h2,
  .setup-column h3 {
    font-size: 1rem;
    line-height: 1.2;
  }

  .setup-column .mode-grid,
  .setup-column .difficulty-grid {
    grid-template-columns: 1fr;
    width: 100%;
    margin: 0.5rem 0 0.75rem;
    gap: 0.55rem;
  }

  .choice-card {
    padding: 0.75rem;
    width: 100%;
  }

  .choice-card strong {
    font-size: 0.92rem;
  }

  .choice-card span {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 0.65rem;
  }

  .shop-item {
    padding: 0.75rem;
    width: 100%;
    box-sizing: border-box;
  }

  .shop-item strong {
    font-size: 0.92rem;
  }

  .shop-item p {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .postcard-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .postcard-copy {
    max-width: 62%;
    font-size: 0.85rem;
  }
}

@page {
  size: 7in 5in;
  margin: 0;
}

@media print {
  body {
    background: #fff;
  }

  .app-shell {
    width: 7in;
    padding: 0;
  }

  .app-shell > :not(.postcard-panel) {
    display: none !important;
  }

  .postcard-panel {
    display: block !important;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .postcard-topline,
  .postcard-actions {
    display: none !important;
  }

  .postcard-print-area {
    margin: 0;
  }

  .postcard-front {
    width: 7in;
    height: 5in;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}
