@charset "UTF-8";

/*
  Meow Lottery (daletou) — Premium Cute UI
  Direction: high-end mobile game polish + clean SaaS glass.
*/

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,650..900&family=Nunito+Sans:wght@400..900&family=Noto+Sans+SC:wght@400..900&display=swap");

:root {
  color-scheme: light;

  /* Typography */
  --kitten-display-font: "Fraunces", "Noto Sans SC", serif;
  --kitten-body-font: "Nunito Sans", "Noto Sans SC", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", sans-serif;
  --kitten-mono-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;

  /* Palette (harmonious, accessible) */
  --ink: #1b1422;
  --ink-2: rgba(27, 20, 34, 0.82);
  --ink-3: rgba(27, 20, 34, 0.64);
  --ink-4: rgba(27, 20, 34, 0.44);

  --rose: #ff3f7f;
  --rose-2: #ff7aa7;
  --sky: #2b76ff;
  --sky-2: #77c6ff;
  --mint: #1ac9a3;

  --bg-0: #fff4f7;
  --bg-1: #fff9fc;
  --bg-2: #f3fbff;

  /* Surfaces */
  --glass: rgba(255, 255, 255, 0.60);
  --glass-2: rgba(255, 255, 255, 0.46);
  --stroke: rgba(27, 20, 34, 0.10);
  --stroke-2: rgba(255, 255, 255, 0.55);

  /* Effects */
  --shadow-lg: 0 34px 90px rgba(27, 20, 34, 0.12), 0 16px 40px rgba(255, 63, 127, 0.12);
  --shadow-md: 0 20px 52px rgba(27, 20, 34, 0.10), 0 10px 22px rgba(27, 20, 34, 0.06);
  --shadow-sm: 0 12px 26px rgba(27, 20, 34, 0.10);
  --focus: rgba(255, 63, 127, 0.26);

  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --ease-out: cubic-bezier(0.2, 0.9, 0.2, 1);
  --ease-spring: cubic-bezier(0.18, 0.9, 0.2, 1.1);
  --dur-1: 140ms;
  --dur-2: 260ms;
  --dur-3: 520ms;

  /* Subtle paw pattern */
  --kitten-paw: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%3E%3Cg%20fill='%231b1422'%20opacity='0.032'%3E%3Ccircle%20cx='18'%20cy='18'%20r='5'/%3E%3Ccircle%20cx='28'%20cy='14'%20r='5'/%3E%3Ccircle%20cx='38'%20cy='14'%20r='5'/%3E%3Ccircle%20cx='48'%20cy='18'%20r='5'/%3E%3Ccircle%20cx='22'%20cy='28'%20r='7'/%3E%3Ccircle%20cx='42'%20cy='28'%20r='7'/%3E%3Cellipse%20cx='32'%20cy='42'%20rx='15'%20ry='11'/%3E%3C/g%3E%3C/svg%3E");

  /* Back-compat aliases (existing HTML/admin inline styles) */
  --primary-color: var(--rose);
  --secondary-color: var(--sky);
  --bg-color: var(--bg-1);
  --card-bg: var(--glass);
  --text-color: var(--ink);
  --muted-text: var(--ink-3);
  --kitten-border: var(--stroke);
  --kitten-shadow: var(--shadow-lg);
  --kitten-focus: var(--focus);
  --primary-shadow: rgba(255, 63, 127, 0.24);
  --secondary-shadow: rgba(43, 118, 255, 0.20);
}

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

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: clamp(16px, 2.8vw, 28px);
  min-height: 100svh;
  height: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--kitten-body-font);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  background-color: var(--bg-1);
  background-image:
    radial-gradient(980px 720px at 14% -14%, rgba(255, 63, 127, 0.18) 0%, rgba(255, 63, 127, 0) 64%),
    radial-gradient(1040px 760px at 96% -6%, rgba(43, 118, 255, 0.13) 0%, rgba(43, 118, 255, 0) 66%),
    radial-gradient(940px 620px at 72% 112%, rgba(26, 201, 163, 0.10) 0%, rgba(26, 201, 163, 0) 64%),
    radial-gradient(1200px 540px at 50% 35%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(150deg, rgba(255, 244, 247, 0.92) 0%, rgba(255, 249, 252, 1) 38%, rgba(243, 251, 255, 0.97) 100%),
    var(--kitten-paw),
    repeating-linear-gradient(
      0deg,
      rgba(27, 20, 34, 0.010) 0px,
      rgba(27, 20, 34, 0.010) 1px,
      rgba(27, 20, 34, 0) 3px,
      rgba(27, 20, 34, 0) 7px
    );
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, repeat;
  background-size: 980px 720px, 1040px 760px, 940px 620px, 1200px 540px, cover, 220px 220px, auto;
  background-position: 0% 0%, 100% 0%, 100% 100%, 50% 40%, 0 0, 32px 46px, 0 0;
}

a {
  color: inherit;
}

/* Layout helpers */
.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(14px, 2.2vw, 20px);
}

.admin-page {
  display: block;
  padding: clamp(16px, 2.8vw, 28px);
}

/* Cat decor */
.cat-ears {
  position: fixed;
  top: clamp(8px, 1.8vw, 16px);
  left: 50%;
  transform: translateX(-50%);
  width: min(820px, 94vw);
  height: 64px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.88;
  filter: drop-shadow(0 16px 28px rgba(27, 20, 34, 0.10));
  animation: floatSoft 5.6s ease-in-out infinite;
}

.cat-ear {
  position: absolute;
  top: 0;
  width: 54px;
  height: 54px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.52));
  border: 1px solid rgba(255, 255, 255, 0.62);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.cat-ear::after {
  content: "";
  position: absolute;
  inset: 14px 12px 10px;
  clip-path: inherit;
  background: radial-gradient(120% 120% at 32% 26%, rgba(255, 63, 127, 0.28) 0%, rgba(255, 63, 127, 0.0) 68%);
  opacity: 0.9;
}

.cat-ear-left {
  left: 22px;
  transform: rotate(-9deg);
}

.cat-ear-right {
  right: 22px;
  transform: rotate(9deg);
}

.cat-tail {
  position: fixed;
  bottom: clamp(10px, 2.2vw, 18px);
  left: 50%;
  transform: translateX(-50%);
  width: min(820px, 94vw);
  height: 10px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, rgba(255, 63, 127, 0.26), rgba(43, 118, 255, 0.18), rgba(26, 201, 163, 0.18));
  opacity: 0.82;
  pointer-events: none;
  filter: blur(0.2px);
}

/* Glass primitives */
.kitten-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--stroke-2);
  background: linear-gradient(180deg, var(--glass), var(--glass-2));
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  position: relative;
  overflow: hidden;
}

.kitten-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(740px 160px at 50% 0%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(520px 240px at 12% 22%, rgba(255, 63, 127, 0.10) 0%, rgba(255, 63, 127, 0) 68%),
    radial-gradient(520px 240px at 92% 14%, rgba(43, 118, 255, 0.10) 0%, rgba(43, 118, 255, 0) 66%);
  opacity: 0.72;
  mix-blend-mode: soft-light;
}

.reveal {
  animation: liftIn var(--dur-3) var(--ease-out) both;
}

/* Topbar */
.topbar {
  width: min(1040px, 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 auto clamp(12px, 1.8vw, 18px);
  padding: 8px 14px;
  line-height: 1;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(27, 20, 34, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62));
  box-shadow: 0 16px 36px rgba(27, 20, 34, 0.10), 0 6px 14px rgba(27, 20, 34, 0.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.18);
  backdrop-filter: blur(14px) saturate(1.18);
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.topbar::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 10px;
  height: 0;
  border-radius: var(--radius-pill);
  background: none;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.70);
  opacity: 0.55;
  z-index: 0;
}

.topbar-user,
.topbar-links {
  position: relative;
  z-index: 1;
}

.topbar-user {
  color: var(--ink-2);
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 6px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 0;
}

.topbar-links {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  transition: color var(--dur-1), transform var(--dur-1), background-color var(--dur-1), box-shadow var(--dur-1);
}

.topbar-link:hover {
  color: var(--rose);
  background: rgba(255, 255, 255, 0.70);
  box-shadow: 0 10px 20px rgba(27, 20, 34, 0.10);
  transform: translateY(-1px);
}

/* Remove decorative gradient strip bars */
.topbar::before {
  content: none !important;
  display: none !important;
}

.cat-tail {
  display: none !important;
  background: none !important;
}

.admin-shell::before {
  content: none !important;
  display: none !important;
}

.topbar-link-primary {
  color: var(--rose);
}

.topbar-link-secondary {
  color: rgba(43, 118, 255, 0.88);
}

#username-display {
  font-weight: 900;
}

#user-credits {
  color: var(--rose);
  font-weight: 950;
}

/* Main containers */
.container {
  width: 100%;
  max-width: 640px;
  padding: clamp(22px, 4.2vw, 36px);
  text-align: center;
  position: relative;
  z-index: 1;
}

h1 {
  margin: 0 0 14px;
  font-family: var(--kitten-display-font);
  font-weight: 900;
  font-size: clamp(1.95rem, 3.2vw, 2.55rem);
  letter-spacing: 0.02em;
  color: var(--ink);
}

h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin: 12px auto 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, rgba(255, 166, 193, 0.95), rgba(255, 210, 117, 0.90));
  opacity: 0.85;
}

.subtitle {
  margin: 0 0 16px;
  color: var(--ink-3);
  font-weight: 650;
  font-size: 1.02rem;
}

.cat-mascot {
  width: 88px;
  margin: 0 auto 10px;
  filter: none;
  transform-origin: 50% 65%;
  animation: mascotPop 1200ms var(--ease-spring) both;
  opacity: 0.92;
}

.cat-mascot svg {
  display: block;
  width: 100%;
  height: auto;
}

.paw-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0 14px;
  opacity: 0.45;
}

.paw-divider::before,
.paw-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(90deg, rgba(27, 20, 34, 0.0), rgba(27, 20, 34, 0.10), rgba(27, 20, 34, 0.0));
}

.paw {
  font-size: 1rem;
  filter: none;
}

/* Sections */
.lottery-display {
  margin-bottom: 1.6rem;
}

.section {
  margin-bottom: 1.3rem;
}

.section h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 850;
  letter-spacing: 0.2px;
  color: var(--ink-3);
}

.numbers-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Lottery balls (3D + glossy) */
.ball {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 950;
  font-size: 1.12rem;
  letter-spacing: 0.5px;
  font-family: var(--kitten-mono-font);
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.96);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.32);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  transform: translateZ(0);
  animation: ballIn 520ms var(--ease-out) both;
}

.ball::before {
  content: "";
  position: absolute;
  inset: -10px;
  background:
    radial-gradient(56px 42px at 28% 22%, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0) 58%),
    radial-gradient(66px 48px at 60% 74%, rgba(0, 0, 0, 0.20) 0%, rgba(0, 0, 0, 0) 62%);
  transform: rotate(-14deg);
  opacity: 0.95;
  pointer-events: none;
}

.ball::after {
  content: "";
  position: absolute;
  top: -26px;
  left: -18px;
  width: 82px;
  height: 82px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 60%);
  opacity: 0.52;
  pointer-events: none;
  mix-blend-mode: screen;
}

.front-section .ball {
  background:
    radial-gradient(140% 130% at 50% 120%, rgba(0, 0, 0, 0.30) 0%, rgba(0, 0, 0, 0) 56%),
    linear-gradient(180deg, rgba(255, 63, 127, 1) 0%, rgba(226, 44, 98, 1) 55%, rgba(164, 20, 63, 1) 120%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    inset 0 -10px 18px rgba(0, 0, 0, 0.24),
    0 14px 28px rgba(255, 63, 127, 0.22),
    0 10px 18px rgba(27, 20, 34, 0.12);
}

.back-section .ball {
  background:
    radial-gradient(140% 130% at 50% 120%, rgba(0, 0, 0, 0.30) 0%, rgba(0, 0, 0, 0) 56%),
    linear-gradient(180deg, rgba(43, 118, 255, 1) 0%, rgba(26, 92, 235, 1) 55%, rgba(14, 52, 168, 1) 120%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    inset 0 -10px 18px rgba(0, 0, 0, 0.24),
    0 14px 28px rgba(43, 118, 255, 0.18),
    0 10px 18px rgba(27, 20, 34, 0.12);
}

.placeholder {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: rgba(27, 20, 34, 0.30);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.80), rgba(255, 255, 255, 0.46));
  border: 1px solid rgba(27, 20, 34, 0.10);
  box-shadow: 0 10px 22px rgba(27, 20, 34, 0.08);
}

/* Primary CTA */
.draw-button,
.kitten-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  font: inherit;
  cursor: pointer;
  line-height: 1;
  vertical-align: middle;
  text-decoration: none;
}

.draw-button {
  width: 100%;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  font-weight: 900;
  font-size: 1.08rem;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.96);
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  z-index: 0;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.40);
  background:
    radial-gradient(120% 180% at 20% 0%, rgba(255, 255, 255, 0.44) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 68%),
    linear-gradient(135deg, var(--rose) 0%, var(--rose-2) 54%, rgba(43, 118, 255, 0.86) 140%);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 22px 54px rgba(255, 63, 127, 0.22),
    0 14px 26px rgba(27, 20, 34, 0.14);
  transform: translateZ(0);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out), filter var(--dur-2) var(--ease-out);
}

.draw-button::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.42) 46%,
    rgba(255, 255, 255, 0) 62%
  );
  opacity: 0.18;
  filter: blur(0.2px);
  transform: translateX(-44%) skewX(-12deg);
  transition: opacity var(--dur-2) var(--ease-out), transform 700ms var(--ease-out);
  z-index: -1;
}

.draw-button:hover {
  transform: translateY(-1px);
  filter: saturate(1.05) brightness(1.01);
  border-color: rgba(255, 255, 255, 0.56);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 28px 66px rgba(255, 63, 127, 0.24),
    0 16px 30px rgba(27, 20, 34, 0.16);
}

.draw-button:hover::before {
  opacity: 0.30;
  transform: translateX(40%) skewX(-12deg);
}

.draw-button:active {
  transform: translateY(1px);
}

.draw-button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(255, 63, 127, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 24px 60px rgba(255, 63, 127, 0.22),
    0 14px 26px rgba(27, 20, 34, 0.14);
}

.draw-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  filter: grayscale(0.06) saturate(0.92);
}

/* Draw action group (primary + secondary) */
.draw-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.draw-actions .draw-button,
.draw-actions .draw-button-secondary {
  width: 100%;
}

.draw-button-secondary {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(27, 20, 34, 0.12);
  background:
    radial-gradient(120% 180% at 20% 0%, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(135deg, rgba(255, 63, 127, 0.12) 0%, rgba(43, 118, 255, 0.12) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.76) 0%, rgba(255, 255, 255, 0.58) 100%);
  color: var(--ink-2);
  border-radius: 16px;
  padding: 13px 16px;
  font: inherit;
  font-weight: 850;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 12px 26px rgba(27, 20, 34, 0.12);
  transform: translateZ(0);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out), filter var(--dur-2) var(--ease-out);
}

.draw-button-secondary::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.38) 46%, rgba(255, 255, 255, 0) 62%);
  opacity: 0.22;
  filter: blur(0.2px);
  transform: translateX(-40%) skewX(-12deg);
  transition: opacity var(--dur-2) var(--ease-out), transform 700ms var(--ease-out);
  z-index: 0;
}

.draw-button-secondary::after {
  content: "x10";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--kitten-mono-font);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  color: rgba(27, 20, 34, 0.82);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(27, 20, 34, 0.10);
  box-shadow: 0 8px 18px rgba(27, 20, 34, 0.12);
  z-index: 1;
}

.draw-button-secondary:hover {
  transform: translateY(-1px);
  filter: saturate(1.03);
  border-color: rgba(27, 20, 34, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 16px 32px rgba(27, 20, 34, 0.14);
}

.draw-button-secondary:hover::before {
  opacity: 0.32;
  transform: translateX(40%) skewX(-12deg);
}

.draw-button-secondary:active {
  transform: translateY(1px);
}

.draw-button-secondary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(255, 63, 127, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 14px 30px rgba(27, 20, 34, 0.14);
}

.draw-button-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  display: inline-block;
  transform: translateY(1px);
  margin: 0 6px;
  opacity: 0.95;
}

/* Buttons */
.kitten-btn {
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-weight: 900;
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out),
    background-color var(--dur-1) var(--ease-out), filter var(--dur-1) var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.kitten-btn:active {
  transform: translateY(1px);
}

.kitten-btn-primary {
  color: rgba(255, 255, 255, 0.98);
  background:
    radial-gradient(120% 160% at 18% 0%, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(135deg, rgba(255, 63, 127, 1) 0%, rgba(255, 122, 167, 0.98) 58%, rgba(255, 245, 250, 0.92) 135%);
  box-shadow: 0 18px 44px rgba(255, 63, 127, 0.22), 0 10px 18px rgba(27, 20, 34, 0.12);
}

.kitten-btn-primary:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
  box-shadow: 0 24px 58px rgba(255, 63, 127, 0.24), 0 12px 22px rgba(27, 20, 34, 0.14);
}

.kitten-btn-ghost {
  background: rgba(255, 255, 255, 0.60);
  color: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, 0.70);
  box-shadow: 0 12px 24px rgba(27, 20, 34, 0.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  backdrop-filter: blur(14px) saturate(1.12);
}

.kitten-btn-ghost:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.72);
}

.kitten-btn-xs {
  padding: 7px 12px;
  font-size: 0.95rem;
}

.link-secondary {
  color: var(--ink-3);
  text-decoration: none;
  font-weight: 750;
}

.link-secondary:hover {
  color: var(--rose);
  text-decoration: underline;
}

/* History */
.history {
  margin-top: 2.2rem;
  border-top: 1px solid rgba(27, 20, 34, 0.10);
  padding-top: 1.2rem;
}

.history h3 {
  margin: 0 0 10px;
  font-family: var(--kitten-display-font);
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--ink);
  font-size: 1.08rem;
}

#history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
  text-align: left;
  scrollbar-color: rgba(255, 63, 127, 0.32) rgba(27, 20, 34, 0.06);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(27, 20, 34, 0.08);
  font-family: var(--kitten-mono-font);
  font-size: 0.95rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.44));
}

.history-item:first-child {
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.history-item:last-child {
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  border-bottom: 0;
}

.history-front {
  color: var(--rose);
  font-weight: 900;
}

.history-back {
  color: rgba(43, 118, 255, 0.92);
  font-weight: 900;
}

#clear-history {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.70);
  font: inherit;
  line-height: 1;
  vertical-align: middle;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 850;
  transition: transform var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out);
  box-shadow: 0 12px 22px rgba(27, 20, 34, 0.08);
}

#clear-history:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.68);
}

/* Account settings */
.account-settings {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(27, 20, 34, 0.10);
  text-align: left;
}

.account-settings-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.account-settings h3 {
  margin: 0;
  font-family: var(--kitten-display-font);
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--ink);
  font-size: 1.06rem;
}

.account-settings-sub {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.92rem;
  font-weight: 700;
}

.account-message {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(27, 20, 34, 0.10);
  background:
    radial-gradient(120% 140% at 22% 0%, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.0) 62%),
    linear-gradient(135deg, rgba(26, 201, 163, 0.10), rgba(43, 118, 255, 0.08)),
    rgba(255, 255, 255, 0.66);
  color: var(--ink-2);
  box-shadow: 0 12px 24px rgba(27, 20, 34, 0.10);
  font-weight: 750;
}

.account-message:empty {
  display: none;
}

.account-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.account-page .account-settings-grid {
  grid-template-columns: 1fr;
  grid-auto-flow: row;
  align-items: start;
  gap: clamp(16px, 2vw, 28px);
}

.account-page .account-settings-grid > * {
  min-width: 0;
}

.account-form {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(27, 20, 34, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.44));
  box-shadow: 0 12px 26px rgba(27, 20, 34, 0.10);
}

.account-form label {
  display: block;
  margin: 0 0 8px;
  color: var(--ink-3);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.12px;
}

.account-form input {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(27, 20, 34, 0.12);
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  backdrop-filter: blur(10px) saturate(1.15);
  transition: box-shadow var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out),
    background-color var(--dur-1) var(--ease-out);
}

.account-form input:focus {
  border-color: rgba(255, 63, 127, 0.34);
  background: rgba(255, 255, 255, 0.94);
}

.account-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.account-row input {
  flex: 1;
  min-width: 0;
}

.account-page .account-row-password {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.account-page .account-row-password input {
  flex: 0 0 auto;
  min-width: 0;
}

.account-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(27, 20, 34, 0.10);
}

#account-save-btn {
  min-width: 200px;
}

/* Account page layout */
.account-container {
  max-width: 720px;
  text-align: left;
}

.account-hero {
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(27, 20, 34, 0.10);
}

.account-title {
  margin: 0 0 6px;
  font-family: var(--kitten-display-font);
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--ink);
}

.account-subtitle {
  margin: 0;
  color: var(--ink-3);
  font-weight: 650;
}

.account-page .account-settings {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.account-topbar-title {
  gap: 10px;
}

.account-topbar-dot {
  color: var(--ink-4);
  transform: translateY(-1px);
}

/* Account page layout */
.account-container {
  max-width: 720px;
  text-align: left;
}

.account-hero {
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(27, 20, 34, 0.10);
}

.account-title {
  margin: 0 0 6px;
  font-family: var(--kitten-display-font);
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--ink);
}

.account-subtitle {
  margin: 0;
  color: var(--ink-3);
  font-weight: 650;
}

.account-page .account-settings {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.account-topbar-title {
  gap: 10px;
}

.account-topbar-dot {
  color: var(--ink-4);
  transform: translateY(-1px);
}

/* Auth */
.auth-container {
  max-width: 440px;
  text-align: left;
  margin-top: 26px;
}

.auth-container h2 {
  margin: 0 0 14px;
  font-family: var(--kitten-display-font);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: 0.2px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-3);
  font-size: 0.95rem;
  font-weight: 850;
}

.form-group input {
  width: 100%;
  padding: 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(27, 20, 34, 0.12);
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  backdrop-filter: blur(10px) saturate(1.15);
  transition: box-shadow var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out),
    background-color var(--dur-1) var(--ease-out);
}

.form-group input:focus {
  border-color: rgba(255, 63, 127, 0.34);
  background: rgba(255, 255, 255, 0.90);
}

.auth-btn {
  width: 100%;
  margin-top: 10px;
}

.toggle-link {
  display: block;
  margin-top: 14px;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  color: rgba(43, 118, 255, 0.88);
  font-weight: 850;
}

.toggle-link:hover {
  text-decoration: underline;
  color: var(--rose);
}

.toggle-link-muted {
  color: var(--ink-3);
  font-size: 0.92em;
  font-weight: 800;
}

.error-msg {
  color: var(--rose);
  margin-top: 10px;
  display: none;
  font-weight: 800;
}

/* QR modal */
#qr-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(27, 20, 34, 0.52);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 18px;
}

.modal-card {
  width: min(340px, 92vw);
  padding: 18px;
  text-align: center;
}

.modal-card h3 {
  margin: 0;
  font-family: var(--kitten-display-font);
  font-weight: 900;
  color: var(--ink);
}

.modal-card p {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.94em;
  font-weight: 650;
}

#qr-canvas-container {
  margin: 16px 0;
}

/* Modal */
.app-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(27, 20, 34, 0.52);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1200;
}

.app-modal.is-open {
  display: flex;
}

.app-modal-card {
  width: min(360px, 92vw);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.70);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.68));
  box-shadow: 0 22px 56px rgba(27, 20, 34, 0.18);
  padding: 18px 18px 16px;
  text-align: center;
  backdrop-filter: blur(14px) saturate(1.15);
}

.app-modal-header {
  margin-bottom: 8px;
}

.app-modal-title {
  margin: 0;
  font-family: var(--kitten-display-font);
  font-size: 1.12rem;
  font-weight: 900;
  color: var(--ink);
}

.app-modal-message {
  margin: 0;
  color: var(--ink-3);
  font-weight: 650;
  line-height: 1.6;
  white-space: pre-line;
}

.app-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.app-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 0;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 10px 20px rgba(27, 20, 34, 0.10);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out),
    filter var(--dur-1) var(--ease-out);
}

.app-modal-btn:active {
  transform: translateY(1px);
}

.app-modal-btn-primary {
  color: rgba(255, 255, 255, 0.98);
  background:
    radial-gradient(120% 160% at 18% 0%, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(135deg, rgba(255, 63, 127, 1) 0%, rgba(255, 122, 167, 0.98) 58%, rgba(255, 245, 250, 0.92) 135%);
}

.app-modal-btn-ghost {
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.70);
  border: 1px solid rgba(27, 20, 34, 0.08);
}

/* Focus */
.kitten-btn:focus-visible,
.nav-tab:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

/* Motion */
@keyframes liftIn {
  0% {
    transform: translateY(12px) scale(0.985);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes ballIn {
  0% {
    transform: translateY(10px) scale(0.92);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes mascotPop {
  0% {
    transform: translateY(10px) scale(0.92);
    opacity: 0;
  }
  60% {
    transform: translateY(-2px) scale(1.02);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes floatSoft {
  0% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(4px);
  }
  100% {
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes drawSecondaryShimmer {
  0% {
    background-position: -220% 0, 50% 50%;
    opacity: 0.34;
  }
  55% {
    background-position: 220% 0, 50% 50%;
    opacity: 0.48;
  }
  100% {
    background-position: 220% 0, 50% 50%;
    opacity: 0.34;
  }
}

@keyframes drawSecondaryPulse {
  0%,
  100% {
    filter: saturate(1.02);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.80),
      0 18px 40px rgba(43, 118, 255, 0.16),
      0 10px 18px rgba(27, 20, 34, 0.10);
  }
  50% {
    filter: saturate(1.06) brightness(1.01);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.86),
      0 22px 48px rgba(43, 118, 255, 0.18),
      0 12px 22px rgba(27, 20, 34, 0.12);
  }
}

/* Responsive polish */
@media (max-width: 520px) {
  .topbar {
    border-radius: 18px;
    padding: 12px;
  }

  .topbar::before {
    left: 12px;
    right: 12px;
  }

  .container {
    padding: 20px;
  }

  .cat-mascot {
    opacity: 0.6;
  }

  h1::after {
    width: 54px;
  }

  .account-settings-grid {
    grid-template-columns: 1fr;
  }

  .account-row {
    flex-direction: column;
    align-items: stretch;
  }

  .account-page .account-row-password {
    flex-direction: column;
  }

  .account-form button {
    width: 100%;
    justify-content: center;
  }

  .account-actions {
    justify-content: stretch;
  }

  #account-save-btn {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .ball,
  .cat-mascot,
  .cat-ears {
    animation: none !important;
  }

  .draw-button-secondary,
  .draw-button-secondary::before {
    animation: none !important;
  }

  .kitten-btn,
  .draw-button,
  .draw-button::before,
  .draw-button-secondary,
  .nav-tab,
  .topbar-link {
    transition: none !important;
  }
}
