@import "tailwindcss";
@import "tw-animate-css";

:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: lining-nums tabular-nums slashed-zero;
  font-feature-settings: "zero" 1;
  font-synthesis: none;
  color-scheme: light dark;
  --sky-top: #6fbde8;
  --sky-mid: #bde2ed;
  --sky-low: #fff0c8;
  --sunset: #f7b45f;
  --ink: #25334a;
  --muted: #66738a;
  --card: rgba(255, 252, 244, 0.9);
  --card-solid: #fffdf8;
  --surface: #f5efe3;
  --line: rgba(68, 82, 103, 0.16);
  --yellow: #f8c944;
  --yellow-deep: #e5a915;
  --ray: #fff9e7;
  --ray-line: #ebcf7a;
  --coral: #df7658;
  --coral-dark: #bb553a;
  --green: #32876a;
  --focus: #245b92;
  --shadow: 0 18px 50px rgba(42, 64, 93, 0.13);
  -webkit-tap-highlight-color: transparent;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--sky-top);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-low) 100%);
  overscroll-behavior: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 600;
}

strong,
b {
  font-weight: 650;
}

main {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.sky-decoration {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.sky-decoration::after {
  content: '';
  position: absolute;
  right: -8vw;
  bottom: -13vw;
  left: -8vw;
  height: 28vw;
  min-height: 180px;
  background: linear-gradient(180deg, rgba(220, 117, 92, 0.08), rgba(185, 98, 105, 0.27));
  border-radius: 50% 50% 0 0 / 32% 32% 0 0;
}

.horizon-sun {
  position: absolute;
  right: clamp(24px, 9vw, 150px);
  bottom: clamp(-115px, -7vw, -60px);
  width: clamp(240px, 33vw, 500px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 44% 38%, #fff1a4 0 8%, #ffd765 35%, #f4a35b 71%);
  box-shadow: 0 0 80px rgba(255, 202, 94, 0.48);
  opacity: 0.72;
}

.cloud {
  position: absolute;
  width: 130px;
  height: 27px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.35);
  filter: blur(0.3px);
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
}

.cloud::before { left: 23px; width: 51px; height: 51px; }
.cloud::after { right: 20px; width: 40px; height: 40px; }
.cloud-one { top: 12%; left: -24px; transform: scale(1.3); }
.cloud-two { top: 27%; right: 4%; transform: scale(0.78); opacity: 0.7; }

.home-shell,
.game-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) clamp(18px, 4vw, 48px) calc(28px + env(safe-area-inset-bottom));
}

.home-shell {
  width: min(100%, 780px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-lockup {
  text-align: center;
}

.brand-mark {
  position: relative;
  width: 78px;
  height: 78px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
}

.brand-mark::before,
.mini-sun::before,
.dialog-sun::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(from 0deg, var(--yellow-deep) 0deg 8deg, transparent 8deg 30deg);
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, transparent 0 46%, #000 47% 70%, transparent 71%);
  mask: radial-gradient(circle, transparent 0 46%, #000 47% 70%, transparent 71%);
}

.brand-mark span,
.dialog-sun span {
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: inset 0 -3px 0 rgba(188, 122, 5, 0.15), 0 6px 18px rgba(214, 145, 24, 0.22);
}

.brand-lockup h1 {
  margin-top: 2px;
  font-size: clamp(3.2rem, 12vw, 5.4rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.brand-lockup h1 span {
  color: var(--coral);
}

.resume-card {
  width: min(100%, 620px);
  margin: 24px auto 0;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 22px;
  text-align: left;
  background: rgba(255, 252, 244, 0.68);
  box-shadow: 0 8px 26px rgba(62, 75, 94, 0.09);
  backdrop-filter: blur(10px);
  transition: transform 160ms ease, background 160ms ease;
}

.resume-card:hover { transform: translateY(-2px); background: var(--card); }
.resume-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 50%; color: #945f06; background: #ffe49a; }
.resume-card strong,
.resume-card small { display: block; }
.resume-card strong { font-size: 0.94rem; }
.resume-card small { margin-top: 3px; color: var(--muted); font-size: 0.79rem; }
.resume-arrow { padding: 0 5px; color: var(--coral-dark); font-size: 1.45rem; }

.choice-heading {
  margin: 36px 0 18px;
  text-align: center;
}

.choice-heading h2 {
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  letter-spacing: -0.02em;
}

.sun-choice-grid {
  width: min(100%, 500px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.sun-choice {
  min-height: 112px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  transition: transform 170ms ease, filter 170ms ease;
}

.sun-choice:hover {
  transform: translateY(-4px);
  filter: drop-shadow(0 9px 11px rgba(141, 99, 20, 0.2));
}

.sun-choice:active,
.icon-button:active,
.submit-button:active,
.primary-button:active,
.secondary-button:active { transform: scale(0.97); }

.mini-sun {
  position: relative;
  width: 102px;
  height: 102px;
  display: grid;
  place-items: center;
}

.mini-sun::after {
  content: '';
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe47c, var(--yellow));
  box-shadow: inset 0 -2px 0 rgba(179, 114, 7, 0.17);
}

.mini-sun b { position: relative; z-index: 1; color: #5b470b; font-size: 1.55rem; }

/* Game */
.game-shell {
  min-height: 100vh;
}

/* Focus is parked here while playing with the mouse; it is not a visible target. */
.game-shell:focus {
  outline: none;
}

.game-header {
  min-height: 50px;
  display: grid;
  grid-template-columns: 50px 1fr;
  align-items: center;
}

.word-count {
  justify-self: end;
  color: var(--coral-dark);
  font-weight: 700;
  font-size: 1.05rem;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 5px 16px rgba(47, 65, 88, 0.08);
  transition: transform 130ms ease, background 130ms ease;
}

.icon-button:hover { background: var(--card-solid); }
.home-button { justify-self: start; }

.progress-row {
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 10px;
  align-items: center;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(73, 85, 103, 0.08);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.48);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow-deep), var(--coral));
  transition: width 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-row > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-align: right;
}

.play-layout {
  margin-top: clamp(18px, 3vh, 34px);
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(250px, 330px);
  gap: clamp(25px, 6vw, 80px);
  align-items: center;
}

.word-maker { min-width: 0; text-align: center; }

.current-word-wrap {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.current-word {
  min-height: 38px;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.35rem, 4.5vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.09em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 150ms ease;
}

.current-word.ready-word { color: var(--green); }
.word-underline { width: min(220px, 60%); height: 2px; margin-top: 7px; border-radius: 99px; background: var(--line); }

.top-actions {
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.sun-board {
  position: relative;
  width: min(344px, 92vw);
  aspect-ratio: 1;
  margin: 5px auto;
  display: grid;
  place-items: center;
}

.sun-board::before {
  content: '';
  position: absolute;
  width: 151px;
  height: 151px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 231, 147, 0.38), transparent 69%);
  filter: blur(9px);
}

.center-letter,
.ray-letter {
  position: absolute;
  border: 1px solid;
  font-weight: 650;
  text-transform: uppercase;
  user-select: none;
  transition: filter 140ms ease, box-shadow 140ms ease, transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.center-letter {
  z-index: 3;
  width: 92px;
  height: 92px;
  border-color: #d9a71e;
  border-radius: 50%;
  color: #523e06;
  background: radial-gradient(circle at 38% 32%, #ffe889, var(--yellow) 62%, #efb92e);
  box-shadow: inset 0 -5px 0 rgba(168, 104, 3, 0.13), 0 8px 25px rgba(203, 138, 13, 0.26);
  font-size: 2.05rem;
}

.ray-letter {
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 67px;
  height: 88px;
  margin: -44px 0 0 -33.5px;
  display: grid;
  place-items: center;
  transform: rotate(var(--angle)) translateY(-117px);
  border-color: var(--ray-line);
  border-radius: 48% 48% 29% 29% / 42% 42% 22% 22%;
  color: var(--ink);
  background: linear-gradient(180deg, #fffdf5, var(--ray));
  box-shadow: inset 0 -4px 0 rgba(219, 175, 61, 0.09), 0 7px 17px rgba(76, 83, 92, 0.1);
  font-size: 1.65rem;
}

.ray-letter span { transform: rotate(calc(-1 * var(--angle))); transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.sun-board.sparse-rays .ray-letter {
  inset: 6%;
  width: 88%;
  height: 88%;
  margin: 0;
  transform: rotate(var(--angle));
  clip-path: var(--sector);
  -webkit-mask: radial-gradient(circle at center, transparent 0 29%, #000 30%);
  mask: radial-gradient(circle at center, transparent 0 29%, #000 30%);
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 43%, #fffef8, var(--ray) 72%);
  box-shadow: none;
}

.sun-board.sparse-rays .ray-letter span {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%) rotate(calc(-1 * var(--angle)));
}

.center-letter:hover,
.ray-letter:hover { filter: brightness(1.035); box-shadow: 0 9px 23px rgba(105, 82, 26, 0.17); }
.center-letter:active,
.ray-letter:active { filter: brightness(0.94); }

.shuffle-action {
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-button,
.primary-button,
.secondary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 99px;
  font-weight: 650;
  transition: transform 130ms ease, background 150ms ease, border-color 150ms ease;
}

.submit-button {
  min-width: 126px;
  padding: 0 27px;
  border: 1px solid var(--coral-dark);
  color: white;
  background: var(--coral);
  box-shadow: 0 7px 19px rgba(191, 83, 57, 0.2);
}

.submit-button:hover,
.submit-button.ready-submit { background: var(--coral-dark); }
.submit-button.ready-submit { box-shadow: 0 0 0 5px rgba(53, 139, 107, 0.16), 0 7px 19px rgba(37, 105, 81, 0.17); border-color: var(--green); background: var(--green); }

.feedback {
  min-height: 23px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 0.8rem;
}

.feedback.success { color: var(--green); font-weight: 650; }
.feedback.warm { color: var(--coral-dark); }

.found-panel {
  align-self: stretch;
  min-height: 430px;
  max-height: 68vh;
  padding: 22px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(15px);
}

.found-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.found-heading-row h2 { font-size: 1.24rem; letter-spacing: -0.025em; }
.found-count {
  position: relative;
  min-width: 40px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 50%;
  color: #6c5107;
  background: #ffe59a;
  font-weight: 700;
  cursor: default;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.found-count.hint-charging {
  animation: hint-charge 1.6s ease-in-out both;
}

.found-count.hint-revealed {
  animation: hint-reveal 650ms ease-out;
}

.found-list {
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.found-list li {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-size: 0.83rem;
  text-transform: capitalize;
  animation: word-in 280ms ease both;
}

.empty-found {
  min-height: 300px;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-found span { color: var(--yellow-deep); font-size: 2rem; }

/* Dialog */
.dialog-sun { position: relative; width: 66px; height: 66px; margin: 2px auto 0; display: grid; place-items: center; }
.dialog-sun span { width: 38px; height: 38px; }
.dialog-copy { padding-right: 27px; }
.dialog-copy.centered { padding: 0; text-align: center; }
.dialog-title { display: block; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.035em; }
.dialog-description { display: block; margin-top: 7px; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.primary-button,
.secondary-button { padding: 0 19px; border: 1px solid; }
.primary-button { border-color: var(--coral-dark); color: white; background: var(--coral); }
.primary-button:hover { background: var(--coral-dark); }
.secondary-button { border-color: var(--line); color: var(--ink); background: var(--surface); }
.secondary-button:hover { border-color: rgba(88, 97, 111, 0.28); }
.celebration { color: var(--yellow-deep); text-align: center; font-size: 4.4rem; line-height: 1; filter: drop-shadow(0 7px 12px rgba(197, 126, 13, 0.2)); }

@keyframes word-in {
  from { opacity: 0; transform: translateY(5px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

@keyframes hint-charge {
  0% { box-shadow: 0 0 0 0 rgba(241, 191, 58, 0); transform: scale(1); }
  35% { box-shadow: 0 0 0 4px rgba(241, 191, 58, 0.14); }
  75% { box-shadow: 0 0 0 9px rgba(241, 191, 58, 0.2); transform: scale(1.08); }
  100% { box-shadow: 0 0 0 13px rgba(241, 191, 58, 0); transform: scale(1.12); }
}

@keyframes hint-reveal {
  0% { filter: brightness(1); transform: scale(1); }
  35% { filter: brightness(1.22); transform: scale(1.22) rotate(8deg); }
  100% { filter: brightness(1); transform: scale(1); }
}

@media (max-width: 760px) {
  .home-shell { justify-content: flex-start; padding-top: calc(22px + env(safe-area-inset-top)); }
  .brand-mark { width: 65px; height: 65px; margin-bottom: 8px; }
  .brand-mark span { width: 40px; height: 40px; }
  .choice-heading { margin-top: 30px; }
  .sun-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .sun-choice { min-height: 92px; }
  .mini-sun { width: 84px; height: 84px; }
  .mini-sun::after { width: 49px; height: 49px; }
  .mini-sun b { font-size: 1.35rem; }

  .game-shell { padding: calc(13px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom)); }
  .progress-row { margin-top: 7px; }
  .play-layout { margin-top: 8px; display: block; }
  .current-word-wrap { min-height: 112px; }
  .current-word { font-size: 1.35rem; }
  .sun-board { width: min(328px, 92vw); margin-top: -4px; margin-bottom: -5px; }
  .ray-letter { width: 61px; height: 81px; margin: -40.5px 0 0 -30.5px; transform: rotate(var(--angle)) translateY(-111px); font-size: 1.5rem; }
  .center-letter { width: 84px; height: 84px; font-size: 1.9rem; }
  .feedback { margin-top: 9px; }
  .found-panel { min-height: 0; max-height: none; margin-top: 16px; padding: 17px; border-radius: 23px; }
  .found-heading-row { padding-bottom: 11px; }
  .found-heading-row h2 { font-size: 1.08rem; }
  .empty-found { min-height: 72px; display: flex; align-items: center; justify-content: center; }
  .empty-found span { font-size: 1.2rem; }
  .found-list { margin-top: 12px; max-height: 118px; overflow: auto; }
}

@media (max-width: 380px) {
  .brand-lockup h1 { font-size: 3rem; }
  .sun-choice { min-height: 86px; }
  .sun-board { width: 300px; }
  .ray-letter { width: 56px; height: 75px; margin: -37.5px 0 0 -28px; transform: rotate(var(--angle)) translateY(-101px); }
  .center-letter { width: 78px; height: 78px; }
  .submit-button { min-width: 108px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions > * { width: 100%; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky-top: #101a35;
    --sky-mid: #253453;
    --sky-low: #684858;
    --sunset: #bd6858;
    --ink: #f3f0e9;
    --muted: #b7bdca;
    --card: rgba(25, 33, 54, 0.88);
    --card-solid: #202a43;
    --surface: #2d354b;
    --line: rgba(228, 224, 215, 0.15);
    --yellow: #efc24b;
    --yellow-deep: #e9b83b;
    --ray: #394157;
    --ray-line: #746b4a;
    --coral: #de826c;
    --coral-dark: #f09b82;
    --green: #74cfad;
    --focus: #8ec7ff;
    --shadow: 0 18px 50px rgba(3, 8, 20, 0.28);
  }

  .sky-decoration::after { background: linear-gradient(180deg, transparent, rgba(104, 51, 71, 0.46)); }
  .horizon-sun { opacity: 0.5; filter: saturate(0.8); box-shadow: 0 0 100px rgba(229, 131, 85, 0.35); }
  .cloud { background: rgba(198, 208, 230, 0.1); }
  .resume-card { background: rgba(26, 34, 54, 0.68); border-color: rgba(255, 255, 255, 0.12); }
  .resume-icon { color: #f5d474; background: #4b412c; }
  .mini-sun b,
  .center-letter { color: #4f3d09; }
  .progress-track { background: rgba(12, 18, 33, 0.46); }
  .ray-letter { background: linear-gradient(180deg, #454d63, var(--ray)); }
  .sun-board.sparse-rays .ray-letter { background: radial-gradient(circle at 50% 43%, #4a5268, var(--ray) 72%); }
  .found-panel { border-color: rgba(255, 255, 255, 0.13); }
  .found-count { color: #f7d77a; background: #4b412c; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (pointer: coarse) {
  button { min-width: 48px; min-height: 48px; }
}
