:root {
  --bg: #f6f7f8;
  --fg: #222;
  --muted: #6b7280;
  --accent: #4f7cff;
  --soft: #e2e6ea;
  --card: #ffffff;
  --shadow: rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e14;
    --fg: #e6e9ef;
    --muted: #9aa3b2;
    --accent: #7aa2ff;
    --soft: #1e2433;
    --card: #121726;
    --shadow: rgba(0,0,0,0.85);
  }
}

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app {
  flex: 1;
  max-width: 460px;
  width: 100%;
  margin: auto;
  padding: 1.2rem 1.1rem 1.6rem;
  text-align: center;
}

.subtitle {
  opacity: 0.7;
  margin: 0 0 1.1rem;
}

.input-section {
  background: var(--card);
  padding: 0.9rem;
  border-radius: 16px;
  box-shadow: 0 10px 30px var(--shadow);
}

textarea {
  width: 100%;
  min-height: 88px;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--soft);
  resize: none;
  font-size: 1rem;
  outline: none;
  background: transparent;
  color: var(--fg);
}

textarea::placeholder {
  color: var(--muted);
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(122,162,255,0.25);
}

.input-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.55rem;
}

button {
  flex: 1;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

button:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.98);
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}

button.secondary {
  background: var(--soft);
  color: var(--fg);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.wheel-section {
  margin-top: 1.2rem;
}

#wheelContainer {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0.6rem auto 0.2rem;
}

#wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent),
    #6fcf97,
    #f2c94c,
    #eb5757,
    #9b51e0,
    var(--accent)
  );
  box-shadow: 0 18px 40px rgba(0,0,0,0.4);
  transition: transform 3.5s cubic-bezier(0.17, 0.67, 0.32, 1);
  will-change: transform;
}

#wheel::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.35), rgba(255,255,255,0.08) 40%, rgba(0,0,0,0.0));
  pointer-events: none;
}

.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 16px solid var(--fg);
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.45));
}

.result {
  margin-top: 1.0rem;
  font-size: 1.6rem;
  min-height: 2.2rem;
  display: grid;
  place-items: center;
}

#resultText {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}

footer {
  text-align: center;
  font-size: 0.78rem;
  opacity: 1;
  padding: 0.9rem 1rem;
}

footer span {
  opacity: 0.7;
  display: inline-block;
}

footer .donate {
  font-style: italic;
}

.supportRow {
  display: flex;
  justify-content: center;
  margin-top: 0.55rem;
}

.supportBtn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--soft);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  box-shadow: 0 10px 26px var(--shadow);
  opacity: 0.95;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.supportBtn:hover {
  filter: brightness(1.02);
}

.supportBtn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 8px 20px var(--shadow);
}

.heartIcon {
  width: 16px;
  height: 16px;
  fill: var(--accent);
}

.fabBar{
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 10px;
  z-index: 50;
}

.fabBtn{
  cursor: pointer;
}

.fabIcon{
  width: 16px;
  height: 16px;
  fill: var(--fg);
  opacity: 0.9;
}

@media (max-width: 420px){
  .fabBar{ right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .fabBtn{ padding: 0.45rem 0.6rem; }
  .fabBtn span{ display:none; }
  .fabIcon, .heartIcon{ width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  #wheel { transition: none; }
}


/* Support prompt (shows after 25 spins) */
.supportModal{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999;
}

.supportModal.open{ display: flex; }

.supportCard{
  width: min(420px, 100%);
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--soft);
  border-radius: 18px;
  padding: 1.05rem 1rem;
  box-shadow: 0 18px 55px rgba(0,0,0,0.45);
  text-align: center;
}

.supportTitle{
  margin: 0 0 0.35rem;
  font-size: 1.12rem;
}

.supportText{
  margin: 0 0 0.9rem;
  line-height: 1.35;
  opacity: 0.85;
}

.supportActions{
  display: grid;
  gap: 0.55rem;
}

.supportDonateBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.supportFine{
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  opacity: 0.7;
}
