:root {
  color-scheme: light;
  --apricot: #f7b984;
  --apricot-soft: #ffd9bd;
  --cream: #fff8f1;
  --white: #ffffff;
  --ink: #2b2521;
  --muted: #6f6258;
  --line: rgba(43, 37, 33, 0.14);
  --shadow: rgba(96, 56, 27, 0.13);
  --danger-soft: #fff0e5;
  --blur-amount: 32px;
  --image-saturation: 1;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.9), transparent 28rem),
    linear-gradient(145deg, var(--apricot) 0%, var(--cream) 48%, var(--white) 100%);
}

.shell {
  width: min(100% - 2rem, 48rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(2rem, 7vh, 5rem) 0 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.35rem;
}

.welcome-panel,
.daily-screen {
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1.5rem 4rem var(--shadow);
  backdrop-filter: blur(18px);
}

.daily-screen[hidden],
[hidden] {
  display: none;
}

.intro {
  display: grid;
  gap: 1rem;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 8vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: 0;
}

p {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.3vw, 1.13rem);
  line-height: 1.65;
}

.content-warning {
  display: grid;
  gap: 0.42rem;
  margin-bottom: 1rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(129, 77, 38, 0.2);
  border-radius: 8px;
  background: var(--danger-soft);
}

.content-warning .eyebrow {
  font-size: 0.68rem;
}

.content-warning h2 {
  font-size: clamp(1.08rem, 3vw, 1.35rem);
}

.content-warning p {
  font-size: 0.88rem;
  line-height: 1.42;
}

.daily-card {
  display: grid;
  gap: 0.85rem;
}

.daily-side,
.exposure-options {
  display: grid;
  gap: 0.72rem;
}

.image-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: var(--frame-aspect, 4 / 5);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #d8d4cf;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
}

.image-frame:focus-visible {
  outline: 3px solid rgba(247, 185, 132, 0.78);
  outline-offset: 3px;
}

.image-frame img {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  filter: blur(var(--blur-amount)) saturate(var(--image-saturation));
  transform: scale(1);
  transition: opacity 180ms ease;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

.image-frame.is-ready img {
  opacity: 1 !important;
}

.blur-progress {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  z-index: 4;
  height: 0.7rem;
  overflow: hidden;
  border: 1px solid rgba(43, 37, 33, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0.45rem 1.3rem rgba(43, 37, 33, 0.12);
  pointer-events: none;
}

.blur-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #2f2823;
}

.image-placeholder {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(216, 212, 207, 0.88)),
    #d8d4cf;
  font-weight: 800;
}

.image-frame.is-ready .image-placeholder {
  display: none;
}

.image-touch-shield {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
}

.celebration {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
}

.celebration span {
  position: absolute;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: var(--apricot);
  box-shadow: 0 0 1rem rgba(255, 255, 255, 0.9);
}

.celebration span:nth-child(1) {
  left: 18%;
  top: 24%;
}

.celebration span:nth-child(2) {
  left: 38%;
  top: 16%;
  background: var(--white);
}

.celebration span:nth-child(3) {
  left: 58%;
  top: 22%;
}

.celebration span:nth-child(4) {
  left: 74%;
  top: 34%;
  background: var(--white);
}

.celebration span:nth-child(5) {
  left: 48%;
  top: 42%;
}

.image-frame.is-celebrating .celebration {
  animation: celebrate-fade 1300ms ease-out forwards;
}

.image-frame.is-celebrating .celebration span {
  animation: celebrate-pop 900ms ease-out forwards;
}

.exposure-option {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

.exposure-option input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #2f2823;
}

.daily-copy {
  display: grid;
  gap: 0.6rem;
}

.entry-heading {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.achievement-star {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  color: #2b2521;
  font-size: 1rem;
  line-height: 1;
  cursor: help;
}

.achievement-star.bronze {
  background: #9b6a58;
  color: #ffffff;
}

.achievement-star.silver {
  background: #d7dce2;
}

.achievement-star.gold {
  background: #f3c84a;
}

.achievement-star::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  z-index: 8;
  width: min(15rem, 70vw);
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 0.8rem 1.8rem rgba(43, 37, 33, 0.16);
  content: attr(data-tooltip);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(0.25rem);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.achievement-star:hover::after,
.achievement-star:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.revealed-field {
  display: grid;
  gap: 0.5rem;
}

.threshold-progress {
  width: min(100%, 22rem);
  height: 0.45rem;
  overflow: hidden;
  border: 1px solid rgba(43, 37, 33, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.threshold-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--apricot);
}

.blurred-text {
  width: fit-content;
  max-width: 100%;
  filter: blur(10px);
  color: transparent;
  text-shadow: 0 0 0.8rem rgba(43, 37, 33, 0.75);
  user-select: none;
}

.blurred-text.is-revealed {
  color: inherit;
  filter: none;
  text-shadow: none;
  user-select: auto;
}

.reveal-button {
  width: fit-content;
  min-height: 2.45rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0.65rem 1.5rem rgba(96, 56, 27, 0.09);
}

.reveal-button:hover {
  background: var(--white);
}

.article-button {
  width: fit-content;
  min-height: 2.5rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
}

.article-button:hover {
  background: var(--white);
}

.status-message {
  margin-top: 1rem;
  color: var(--ink);
  font-weight: 700;
}

.level-select {
  display: grid;
  gap: 0.75rem;
}

.level-select[hidden] {
  display: none;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr));
  gap: 0.55rem;
}

.level-button {
  position: relative;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0.5rem 1.2rem rgba(96, 56, 27, 0.08);
}

.level-button:hover,
.level-button:focus-visible {
  background: var(--white);
}

.level-star {
  position: absolute;
  top: 0.22rem;
  right: 0.32rem;
  font-size: 0.8rem;
  line-height: 1;
}

.level-star.bronze {
  color: #7b4b3d;
}

.entry-number {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.level-star.silver {
  color: #858f9c;
}

.level-star.gold {
  color: #c99716;
}

.phobia-form {
  margin-top: 2rem;
  display: grid;
  gap: 0.65rem;
}

label {
  color: var(--ink);
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 3.25rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  box-shadow: 0 0.7rem 1.5rem rgba(96, 56, 27, 0.08);
}

select:focus-visible,
.reveal-button:focus-visible,
.secondary-button:focus-visible,
.daily-button:focus-visible {
  outline: 3px solid rgba(247, 185, 132, 0.78);
  outline-offset: 3px;
}

.form-message {
  min-height: 1.5rem;
  color: var(--ink);
  font-weight: 700;
}

.achievement-context {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
}

.progress-counter {
  color: var(--ink);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.completion-message {
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(43, 37, 33, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.45;
  box-shadow: 0 0.7rem 1.4rem rgba(96, 56, 27, 0.08);
}

.achievement-card {
  min-height: 4.5rem;
  padding: 0.75rem;
  border: 1px solid rgba(43, 37, 33, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 0.7rem 1.4rem rgba(96, 56, 27, 0.08);
}

.achievement-card span,
.achievement-card strong {
  display: block;
}

.achievement-card span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.achievement-card strong {
  margin-top: 0.35rem;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
}

.feedback-button {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1rem 2rem rgba(43, 37, 33, 0.16);
}

.article-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(43, 37, 33, 0.34);
}

.article-overlay[hidden] {
  display: none;
}

.article-panel {
  position: relative;
  width: min(100%, 46rem);
  max-height: min(82vh, 46rem);
  display: grid;
  gap: 0.9rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 1.5rem 4rem rgba(43, 37, 33, 0.24);
}

.article-panel h2 {
  padding-right: 2.4rem;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.article-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.article-text {
  overflow: auto;
  max-height: min(65vh, 36rem);
  padding-right: 0.35rem;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

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

.actions.has-back {
  grid-template-columns: minmax(7rem, 0.28fr) 1fr;
}

.actions.has-practice {
  grid-template-columns: minmax(6.5rem, 0.34fr) 1fr;
}

.actions.has-level-select {
  grid-template-columns: minmax(6.5rem, 0.28fr) minmax(9rem, 0.36fr) 1fr;
}

.secondary-button,
.daily-button {
  width: 100%;
  min-height: 4.25rem;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  background: #2f2823;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 1.25rem 3rem rgba(47, 40, 35, 0.22);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.secondary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1rem 2rem rgba(96, 56, 27, 0.1);
}

.daily-button:hover {
  background: #41372f;
  box-shadow: 0 1.5rem 3.4rem rgba(47, 40, 35, 0.25);
  transform: translateY(-2px);
}

.secondary-button:hover {
  background: var(--white);
  transform: translateY(-2px);
}

.daily-button:active {
  transform: translateY(0);
}

.secondary-button:active {
  transform: translateY(0);
}

.daily-button:disabled {
  cursor: wait;
  opacity: 0.76;
  transform: none;
}

@media (max-width: 38rem) {
  .shell {
    width: min(100% - 1.25rem, 48rem);
    padding-top: 0.75rem;
    gap: 0.85rem;
  }

  .welcome-panel,
  .daily-screen {
    padding: 1.1rem;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .actions.has-back {
    grid-template-columns: 1fr;
  }

  .actions.has-practice {
    grid-template-columns: 1fr;
  }

  .actions.has-level-select {
    grid-template-columns: 1fr;
  }

  .content-warning {
    margin-bottom: 0.75rem;
  }

  .exposure-option {
    font-size: 0.82rem;
  }

  .progress-counter {
    grid-template-columns: 1fr;
  }
}

@media (orientation: landscape) and (min-width: 46rem) {
  .shell {
    width: min(100% - 2rem, 64rem);
    padding-top: 1rem;
    gap: 0.9rem;
  }

  .daily-screen {
    padding: 1rem;
  }

  .content-warning {
    margin-bottom: 0.8rem;
    padding: 0.62rem 0.75rem;
  }

  .daily-card {
    grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.85fr);
    align-items: start;
    gap: 1rem;
  }

  .image-frame {
    aspect-ratio: auto;
    height: min(62vh, 34rem);
  }

  .daily-side {
    align-content: start;
    gap: 0.9rem;
    min-width: 0;
  }

  .daily-copy {
    gap: 0.72rem;
  }

  .threshold-progress {
    width: 100%;
  }
}

@keyframes celebrate-fade {
  0% {
    opacity: 0;
  }

  16% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes celebrate-pop {
  0% {
    transform: translateY(0) scale(0.4);
  }

  45% {
    transform: translateY(-3rem) scale(1);
  }

  100% {
    transform: translateY(-5rem) scale(0.2);
  }
}
