/* Mobile/tablet foundation shared by all KonniePaw pages. */
:root {
  --meow-safe-top: env(safe-area-inset-top, 0px);
  --meow-safe-right: env(safe-area-inset-right, 0px);
  --meow-safe-bottom: env(safe-area-inset-bottom, 0px);
  --meow-safe-left: env(safe-area-inset-left, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(12px + var(--meow-safe-top));
}

body {
  padding-left: var(--meow-safe-left);
  padding-right: var(--meow-safe-right);
  padding-bottom: var(--meow-safe-bottom);
}

button,
a,
input,
select,
textarea,
[role="button"] {
  touch-action: manipulation;
}

input,
select,
textarea {
  font-size: max(16px, 1em);
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

.meow-game-touch-guard,
.chip,
.slot,
.branch,
.cloud,
.left-row,
.dropzone,
.stage,
.block,
[draggable="true"],
[data-drop-zone],
[data-role="sort"],
[data-role="distractors"],
.sortable-ghost,
.sortable-chosen {
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.meow-game-touch-guard img,
.chip img,
.slot img,
.branch img,
.cloud img,
.dropzone img,
.stage img,
[draggable="true"] img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

@media (hover: none) and (pointer: coarse) {
  .chip,
  .slot,
  .branch,
  .cloud,
  .left-row,
  [data-drop-zone],
  [data-role="sort"],
  [data-role="distractors"] {
    touch-action: none;
  }

  .dropzone,
  .stage {
    touch-action: none;
  }
}

.meow-scroll-x {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.meow-install-button {
  position: fixed;
  right: calc(16px + var(--meow-safe-right));
  bottom: calc(16px + var(--meow-safe-bottom));
  z-index: 100020;
  min-height: 48px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #2d2140;
  background: #fff8ef;
  border: 1px solid rgba(222, 196, 157, .92);
  border-radius: 999px;
  box-shadow: 0 16px 42px rgba(83, 54, 24, .18);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.meow-install-button:hover {
  background: #fff2d9;
}

.meow-install-tip {
  position: fixed;
  left: calc(14px + var(--meow-safe-left));
  right: calc(14px + var(--meow-safe-right));
  bottom: calc(14px + var(--meow-safe-bottom));
  z-index: 100019;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  color: #2d2140;
  background: rgba(255, 248, 239, .98);
  border: 1px solid rgba(222, 196, 157, .92);
  border-radius: 18px;
  box-shadow: 0 18px 52px rgba(83, 54, 24, .20);
  font-weight: 850;
}

.meow-install-tip button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: inherit;
  background: rgba(228, 166, 56, .18);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

body.meow-standalone .meow-install-button,
body.meow-standalone .meow-install-tip,
body.meow-standalone .meow-install-card,
body.meow-standalone .meow-install-mini {
  display: none !important;
}

.meow-install-card {
  position: fixed;
  left: calc(12px + var(--meow-safe-left));
  right: calc(12px + var(--meow-safe-right));
  bottom: calc(14px + var(--meow-safe-bottom));
  z-index: 100060;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  color: #2d2140;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 205, 124, .28), transparent 32%),
    rgba(255, 250, 243, .98);
  border: 1px solid rgba(222, 196, 157, .92);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(83, 54, 24, .24);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  transition: opacity .2s ease, transform .2s ease;
}

.meow-install-card.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.meow-install-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: #6a5743;
  background: rgba(238, 219, 190, .72);
  font: inherit;
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
}

.meow-install-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff0d5;
  box-shadow: inset 0 0 0 1px rgba(222, 196, 157, .78);
  overflow: hidden;
}

.meow-install-icon img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.meow-install-copy {
  min-width: 0;
  padding-right: 28px;
  display: grid;
  gap: 4px;
}

.meow-install-copy strong {
  font-size: 16px;
  line-height: 1.15;
  font-weight: 950;
}

.meow-install-copy span {
  color: #746987;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 750;
}

.meow-install-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.meow-install-primary,
.meow-install-secondary,
.meow-install-mini {
  min-height: 44px;
  border-radius: 13px;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.meow-install-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #8a62dc, #08a8f5);
  box-shadow: 0 10px 24px rgba(83, 69, 213, .20);
}

.meow-install-secondary {
  border: 1px solid rgba(222, 196, 157, .92);
  color: #4a3f5c;
  background: rgba(255, 255, 255, .74);
  padding: 0 14px;
}

.meow-install-mini {
  position: fixed;
  right: calc(12px + var(--meow-safe-right));
  bottom: calc(76px + var(--meow-safe-bottom));
  z-index: 100055;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 6px;
  border: 1px solid rgba(222, 196, 157, .92);
  color: #2d2140;
  background: rgba(255, 250, 243, .98);
  box-shadow: 0 16px 44px rgba(83, 54, 24, .20);
}

.meow-install-mini img {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.meow-install-mini span {
  font-size: 13px;
}

[data-theme="dark"] .meow-install-card,
body.meow-dark .meow-install-card,
[data-theme="dark"] .meow-install-mini,
body.meow-dark .meow-install-mini {
  color: #f4f0ff;
  background:
    radial-gradient(circle at 12% 8%, rgba(139, 92, 246, .20), transparent 32%),
    rgba(20, 24, 36, .98);
  border-color: rgba(154, 130, 204, .38);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
}

[data-theme="dark"] .meow-install-copy span,
body.meow-dark .meow-install-copy span {
  color: #cfd6e6;
}

[data-theme="dark"] .meow-install-icon,
body.meow-dark .meow-install-icon {
  background: rgba(139, 92, 246, .18);
  box-shadow: inset 0 0 0 1px rgba(154, 130, 204, .28);
}

[data-theme="dark"] .meow-install-close,
body.meow-dark .meow-install-close,
[data-theme="dark"] .meow-install-secondary,
body.meow-dark .meow-install-secondary {
  color: #f4f0ff;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(154, 130, 204, .34);
}

@media (hover: none) and (pointer: coarse) {
  button,
  .btn,
  .meow-btn,
  .plan-action,
  .tiny-btn,
  .cal-btn,
  .type-pill,
  .game-card,
  .choice,
  .option {
    min-height: 44px;
  }

  .meow-btn:hover,
  .game-card:hover,
  .plan-action:hover {
    transform: none !important;
  }
}

@media (max-width: 900px) {
  body {
    overflow-x: hidden;
  }

  .meow-navbar,
  .meow-navbar.is-game-navbar {
    width: min(calc(100vw - 20px), 720px) !important;
    margin: 8px auto 18px !important;
    margin-left: auto !important;
    transform: none !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto auto !important;
    gap: 12px !important;
    padding: 14px !important;
    border-radius: 20px !important;
  }

  .meow-brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    gap: 10px;
  }

  .meow-brand::after,
  .meow-nav-stats::after {
    display: none !important;
  }

  .meow-brand-logo {
    width: 44px !important;
    height: 44px !important;
  }

  .meow-brand-name {
    font-size: clamp(26px, 8vw, 34px) !important;
  }

  .meow-language-menu {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-right: 0 !important;
  }

  .meow-nav-links,
  .meow-navbar.is-game-navbar .meow-nav-links {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(64px, 1fr)) !important;
    gap: 6px !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .meow-nav-links > .meow-btn,
  .meow-navbar.is-game-navbar .meow-nav-links > .meow-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 6px 4px !important;
    flex-direction: column;
    gap: 4px !important;
    overflow: hidden !important;
    border-radius: 16px !important;
    font-size: 11px !important;
    line-height: 1.05 !important;
    white-space: normal !important;
    text-align: center !important;
  }

  .meow-nav-icon,
  .meow-text-icon {
    width: 22px !important;
    height: 22px !important;
    font-size: 21px !important;
  }

  .meow-nav-stats {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    gap: 8px !important;
  }

  .meow-stat-pill {
    min-height: 42px !important;
    padding: 7px 10px !important;
    gap: 8px !important;
    border-radius: 15px !important;
  }

  .meow-stat-icon {
    width: 24px !important;
    height: 24px !important;
    font-size: 19px !important;
  }

  .meow-stat-value {
    font-size: 15px !important;
  }

  .meow-stat-label {
    display: none;
  }

  .meow-account-area {
    grid-column: 2;
    grid-row: 3;
    justify-self: end;
    width: auto !important;
  }

  .meow-user-card {
    min-height: 42px !important;
    gap: 8px !important;
  }

  .meow-user-avatar {
    width: 40px !important;
    height: 40px !important;
  }

  .meow-user-name {
    max-width: min(22ch, 210px) !important;
    font-size: 14px !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.12 !important;
  }

  .meow-user-plan,
  .meow-user-arrow {
    display: none;
  }

  .meow-dd-menu {
    position: absolute !important;
    top: calc(100% + 10px) !important;
    left: auto !important;
    right: 0 !important;
    bottom: auto !important;
    width: min(320px, calc(100vw - 24px)) !important;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    transform: none !important;
    border-radius: 22px !important;
  }

  .meow-language-menu .meow-dd-menu {
    right: 0 !important;
    left: auto !important;
    width: min(220px, calc(100vw - 24px)) !important;
  }

  .meow-feedback-dialog,
  .mp-dialog,
  .ms-dialog,
  .meow-taskgen-dialog {
    width: min(100%, calc(100vw - 20px)) !important;
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
  }
}

@media (max-width: 520px) {
  .meow-navbar,
  .meow-navbar.is-game-navbar {
    width: calc(100vw - 12px) !important;
    padding: 12px 10px !important;
  }

  .meow-nav-links,
  .meow-navbar.is-game-navbar .meow-nav-links {
    grid-template-columns: repeat(5, minmax(54px, 1fr)) !important;
  }

  .meow-nav-links > .meow-btn,
  .meow-navbar.is-game-navbar .meow-nav-links > .meow-btn {
    min-height: 46px !important;
    font-size: 10px !important;
  }

  .meow-brand-logo {
    width: 38px !important;
    height: 38px !important;
  }

  .meow-brand-name {
    font-size: clamp(23px, 8.5vw, 30px) !important;
  }

  .meow-install-button {
    left: calc(12px + var(--meow-safe-left));
    right: calc(12px + var(--meow-safe-right));
    width: auto;
  }

  .meow-install-card {
    bottom: calc(16px + var(--meow-safe-bottom));
  }

  .meow-install-mini {
    right: calc(12px + var(--meow-safe-right));
    bottom: calc(82px + var(--meow-safe-bottom));
  }

  .meow-notes-launcher {
    left: auto !important;
    right: calc(12px + var(--meow-safe-right)) !important;
    top: calc(74px + var(--meow-safe-top)) !important;
    bottom: auto !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    justify-content: center !important;
    gap: 0 !important;
    border-radius: 50% !important;
    opacity: .88 !important;
  }

  .meow-notes-launcher .mn-launcher-text {
    display: none !important;
  }

  .meow-notes-launcher .mn-launcher-icon {
    width: 38px !important;
    height: 38px !important;
    margin-left: 0 !important;
    transform: none !important;
  }

  .meow-notes-launcher .mn-dot {
    left: 31px !important;
    top: 6px !important;
  }

  body.meow-notes-open .meow-notes-launcher {
    opacity: 0 !important;
    pointer-events: none !important;
  }
}
