:root {
  --lavender-50: #fbf8ff;
  --lavender-100: #f0eaff;
  --lavender-200: #ddd3ff;
  --lavender-400: #ad98f2;
  --lavender-600: #7a65cf;
  --ink: #262034;
  --muted: #6f6680;
  --glass: rgba(255, 255, 255, 0.58);
  --mint: #bfe8d7;
  --coral: #ffb8aa;
  --butter: #f7dfa4;
  --danger: #be3f5a;
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(125deg, rgba(247, 232, 255, 0.94) 0%, rgba(255, 255, 255, 0) 36%),
    linear-gradient(235deg, rgba(221, 246, 241, 0.62) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(18deg, rgba(255, 237, 229, 0.54) 0%, rgba(255, 255, 255, 0) 46%),
    linear-gradient(160deg, #ffffff 0%, #f7e8ff 46%, #f4fbff 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-shell[aria-hidden="true"] {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2.5rem);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.85rem;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  border: 2px solid rgba(122, 101, 207, 0.42);
  border-radius: 0.75rem 0.75rem 1rem 1rem;
  background:
    radial-gradient(circle at 48% 74%, #a994f4 0 17%, transparent 18%),
    radial-gradient(circle at 32% 58%, #8fc8ff 0 15%, transparent 16%),
    radial-gradient(circle at 63% 47%, #b8b7c2 0 14%, transparent 15%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(221, 211, 255, 0.62));
  box-shadow: 0 0.75rem 2rem rgba(122, 101, 207, 0.12);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.35rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.add-button,
.icon-close {
  display: inline-grid;
  place-items: center;
  border: 0;
  color: #fff;
  background: var(--lavender-600);
  box-shadow: 0 0.9rem 2rem rgba(122, 101, 207, 0.22);
}

.add-button {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.add-button span {
  transform: translateY(-0.08rem);
}

.add-button:disabled {
  cursor: default;
  opacity: 0.45;
  box-shadow: none;
}

.ghost-button {
  min-height: 2.65rem;
  border: 1px solid rgba(122, 101, 207, 0.24);
  border-radius: var(--radius);
  color: var(--lavender-600);
  background: rgba(255, 255, 255, 0.62);
  padding: 0 0.9rem;
}

.hidden {
  display: none !important;
}

.stage {
  min-height: 0;
  display: grid;
  place-items: end center;
  padding: 0 clamp(1rem, 3vw, 2.5rem) clamp(1rem, 2.5vh, 1.8rem);
}

.jar-wrap {
  position: relative;
  width: clamp(19rem, 52vw, 42rem);
  height: min(76vh, 47rem);
  min-height: 31rem;
  display: grid;
  place-items: stretch;
}

.jar-cap {
  position: absolute;
  z-index: 3;
  top: -0.35rem;
  left: 50%;
  width: 45%;
  height: 1.45rem;
  transform: translateX(-50%);
  border: 3px solid #171717;
  border-radius: 0.45rem 0.45rem 0.25rem 0.25rem;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, #ffffff 0%, #d8d8d8 45%, #9e9e9e 100%);
  box-shadow:
    inset 0 0.25rem 0 rgba(255, 255, 255, 0.76),
    inset 0 -0.25rem 0 rgba(0, 0, 0, 0.14),
    0 0.8rem 1.6rem rgba(0, 0, 0, 0.13);
}

.jar {
  position: relative;
  overflow: visible;
  isolation: isolate;
}

.ball-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  clip-path: polygon(30% 6%, 70% 6%, 70% 16%, 80% 22%, 86% 33%, 92% 91%, 89% 100%, 11% 100%, 8% 91%, 14% 33%, 20% 22%, 30% 16%);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.68), transparent 18% 78%, rgba(0, 0, 0, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(210, 210, 210, 0.2));
}

.jar-outline {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 1.3rem 2.2rem rgba(0, 0, 0, 0.16));
  pointer-events: none;
}

.jar-glass,
.jar-mouth,
.jar-neck {
  fill: rgba(255, 255, 255, 0.1);
  stroke: #171717;
  stroke-width: 2.6;
  vector-effect: non-scaling-stroke;
}

.jar-mouth {
  stroke-width: 3;
}

.jar-mouth,
.jar-neck {
  fill: none;
}

.jar-shadow {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: -0.9rem;
  height: 1.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  filter: blur(0.55rem);
}

.adventure-ball {
  --ball-size: 5.8rem;
  position: absolute;
  width: var(--ball-size);
  height: var(--ball-size);
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  overflow: hidden;
  background: var(--lavender-200);
  box-shadow:
    inset 0 0.7rem 1.1rem rgba(255, 255, 255, 0.28),
    inset 0 -0.9rem 1rem rgba(38, 32, 52, 0.12),
    0 0.7rem 1.4rem rgba(89, 73, 154, 0.16);
  outline: none;
  user-select: none;
  will-change: transform;
}

.adventure-ball:focus-visible {
  box-shadow:
    0 0 0 4px rgba(122, 101, 207, 0.3),
    inset 0 0.7rem 1.1rem rgba(255, 255, 255, 0.28),
    inset 0 -0.9rem 1rem rgba(38, 32, 52, 0.12),
    0 0.7rem 1.4rem rgba(89, 73, 154, 0.16);
}

.ball-image,
.ball-tint,
.ball-label {
  position: absolute;
  inset: 0;
}

.ball-image {
  background-position: center;
  background-size: cover;
}

.ball-tint {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.56), transparent 25%),
    linear-gradient(180deg, rgba(38, 32, 52, 0.03), rgba(38, 32, 52, 0.58));
}

.ball-label {
  top: auto;
  display: grid;
  align-content: end;
  min-height: 56%;
  padding: 0.55rem 0.5rem 0.72rem;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 4px rgba(15, 10, 28, 0.5);
}

.ball-title,
.ball-date {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ball-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.ball-date {
  margin-top: 0.16rem;
  font-size: 0.62rem;
  font-weight: 700;
  opacity: 0.95;
  white-space: nowrap;
}

.modal {
  width: min(calc(100vw - 2rem), 27rem);
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(37, 28, 63, 0.28);
  backdrop-filter: blur(10px);
}

.modal-panel {
  display: grid;
  gap: 1rem;
  border: 1px solid rgba(122, 101, 207, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1.4rem 4rem rgba(62, 46, 111, 0.22);
  padding: 1.25rem;
}

.auth-panel {
  padding-top: 1.45rem;
}

.modal h2 {
  font-size: 1.25rem;
  line-height: 1.15;
  letter-spacing: 0;
}

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

.icon-close {
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 1.45rem;
  background: var(--lavender-400);
  box-shadow: none;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

input {
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(122, 101, 207, 0.22);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  padding: 0.82rem 0.86rem;
  outline: none;
}

input:focus {
  border-color: rgba(122, 101, 207, 0.7);
  box-shadow: 0 0 0 4px rgba(122, 101, 207, 0.12);
}

.input-row {
  position: relative;
  display: block;
}

.input-row input {
  padding-right: 4.2rem;
}

.character-count {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.image-picker {
  cursor: pointer;
}

.image-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.image-preview {
  display: block;
  height: 9rem;
  border: 1px dashed rgba(122, 101, 207, 0.42);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(247, 232, 255, 0.86), rgba(255, 255, 255, 0.9));
  background-position: center;
  background-size: cover;
}

.primary-button,
.danger-button {
  min-height: 2.8rem;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 850;
}

.primary-button {
  background: var(--lavender-600);
  box-shadow: 0 1rem 2rem rgba(122, 101, 207, 0.18);
}

.danger-button {
  background: var(--danger);
}

.form-message {
  min-height: 1.1rem;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 760;
}

.detail-panel {
  gap: 0.85rem;
}

.detail-image {
  min-height: 14rem;
  border-radius: var(--radius);
  background-position: center;
  background-size: cover;
}

.detail-date {
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .topbar {
    align-items: flex-start;
    padding-top: 0.85rem;
  }

  h1 {
    font-size: 1.15rem;
  }

  .brand p {
    font-size: 0.8rem;
  }

  .ghost-button {
    min-height: 2.35rem;
    padding: 0 0.7rem;
  }

  .add-button {
    width: 2.65rem;
    height: 2.65rem;
    font-size: 1.75rem;
  }

  .stage {
    min-height: calc(100vh - 5.6rem);
    padding-bottom: 0.95rem;
  }

  .jar-wrap {
    width: min(92vw, 24rem);
    height: min(72vh, 38rem);
    min-height: 28rem;
  }

  .ball-title {
    font-size: 0.64rem;
  }

  .ball-date {
    font-size: 0.56rem;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 0.65rem;
  }

  .brand {
    gap: 0.6rem;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
  }

  .top-actions {
    gap: 0.45rem;
  }

  .ghost-button {
    font-size: 0.82rem;
  }

  .modal-panel {
    padding: 1rem;
  }
}
