@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600&display=swap");

:root {
  color-scheme: light dark;
  --bg: #f2f2f2;
  --panel: #ffffff;
  --ink: #1f1f1f;
  --muted: #7b7b7b;
  --line: #e0e0e0;
  --accent: #5f6368;
  --accent-strong: #3c4043;
  --shadow: 0 8px 18px rgba(0, 0, 0, 0.05);
  --radius-lg: 24px;
  --radius-pill: 40px;
  --festive-bg: linear-gradient(155deg, #fff7ea, #ffe8ce 55%, #fffaf2);
  --festive-border: #f1d2a7;
  --festive-ink: #8b4a16;
  --festive-ink-strong: #6b3d15;
  --token-bg: radial-gradient(circle at 30% 30%, #ffe4a8, #d9a24a 65%, #b7782e 100%);
  --token-border: rgba(145, 85, 24, 0.6);
  --token-stroke: #7a3f0c;
  --confirm-bg: #8b2f13;
  --confirm-bg-hover: #6f2510;
  --scrim: rgba(25, 25, 25, 0.35);
  --note-ink: rgba(248, 242, 234, 0.9);
  --chip-bg: #f4f4f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 14px;
}

.response-area {
  width: min(860px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.response-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}

.reward {
  display: flex;
  width: 100%;
  justify-content: center;
  max-height: 0;
  opacity: 0;
  transform: scale(0.92);
  filter: blur(10px);
  pointer-events: none;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.35s ease,
    filter 0.35s ease;
}

.reward.visible {
  max-height: 60px;
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
  pointer-events: auto;
  animation: rewardPop 0.45s ease both;
}

.pill {
  border: 1px solid var(--line);
  background: #f7f7f7;
  color: var(--accent-strong);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease, background 0.2s ease;
}

.pill:hover {
  transform: translateY(-1px);
  border-color: #c8c8c8;
  background: #f1f1f1;
}

.response-card.reveal {
  animation: blurIn 0.45s ease forwards;
}

.response-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
}

.response-text {
  font-size: 16px;
  line-height: 1.7;
  min-height: 24px;
}

.response-text.typing::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 16px;
  margin-left: 4px;
  background: var(--accent);
  animation: caret 0.9s step-end infinite;
  vertical-align: baseline;
}

.input-panel {
  width: min(720px, 94vw);
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

#userInput {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-size: 16px;
  line-height: 1.6;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  outline: none;
}

#sendBtn {
  border: 1px solid var(--line);
  background: #f4f4f4;
  color: var(--accent-strong);
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border 0.2s ease;
}

#sendBtn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

#sendBtn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

#sendBtn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #c8c8c8;
}

.hint {
  font-size: 11px;
  color: var(--muted);
  padding-left: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
}

.modal-scene {
  position: relative;
  perspective: 1200px;
  width: min(380px, 86vw);
}

.modal-card {
  position: relative;
  background: var(--festive-bg);
  border: 1px solid var(--festive-border);
  border-radius: 22px;
  padding: 22px 20px;
  text-align: center;
  transform-style: preserve-3d;
  transform-origin: center;
  transform: rotateY(-360deg) scale(0.6);
  transition: transform 1.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 22px 50px rgba(112, 66, 22, 0.2);
}

.modal.open .modal-card {
  transform: rotateY(0deg) scale(1);
}

.modal-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  border: 1px dashed rgba(208, 142, 66, 0.35);
  pointer-events: none;
}

.card-title {
  font-size: 16px;
  color: var(--festive-ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.token {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--token-bg);
  border: 2px solid var(--token-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.4);
}

.token svg {
  width: 60px;
  height: 60px;
  stroke: var(--token-stroke);
  stroke-width: 6px;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.card-text {
  font-size: 14px;
  color: var(--festive-ink-strong);
  margin-bottom: 8px;
}

.card-blessing {
  font-size: 13px;
  line-height: 1.7;
  color: var(--festive-ink-strong);
  margin-bottom: 18px;
}

.confirm-btn {
  border: none;
  background: var(--confirm-bg);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.confirm-btn:hover {
  transform: translateY(-1px);
  background: var(--confirm-bg-hover);
}

.modal-note {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(92vw, 520px);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  color: var(--note-ink);
}

.dots span {
  display: inline-block;
  opacity: 0.3;
  animation: blink 1.2s infinite;
}

.dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blurIn {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes rewardPop {
  0% {
    opacity: 0;
    transform: scale(0.86);
    filter: blur(12px);
  }

  70% {
    opacity: 1;
    transform: scale(1.03);
    filter: blur(2px);
  }

  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes blink {

  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 1;
  }
}

@keyframes caret {

  0%,
  60% {
    opacity: 1;
  }

  61%,
  100% {
    opacity: 0;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --panel: #1f1f1f;
    --ink: #f1f1f1;
    --muted: #a0a0a0;
    --line: #2e2e2e;
    --accent: #b5b5b5;
    --accent-strong: #e0e0e0;
    --shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    --festive-bg: linear-gradient(155deg, #2b1a0f, #3a2212 55%, #24160c);
    --festive-border: #5d3a1d;
    --festive-ink: #f3c98b;
    --festive-ink-strong: #f1b870;
    --token-bg: radial-gradient(circle at 30% 30%, #8a5a1f, #6d4217 65%, #4c2d10 100%);
    --token-border: rgba(248, 198, 120, 0.5);
    --token-stroke: #f4c37a;
    --confirm-bg: #b5481e;
    --confirm-bg-hover: #d15a2a;
    --scrim: rgba(0, 0, 0, 0.6);
    --note-ink: rgba(240, 220, 190, 0.9);
    --chip-bg: #3d3d3d;
  }

  #sendBtn {
    background: #2a2a2a;
  }

  .pill {
    background: #262626;
  }
}

@media (max-width: 640px) {
  .response-card {
    padding: 14px 16px;
  }

  .input-wrap {
    padding: 12px;
  }

  .modal-card {
    padding: 20px 18px;
  }
}

@media (max-width: 420px) {
  .shell {
    gap: 12px;
    padding: 16px 12px;
  }

  .response-text {
    font-size: 15px;
  }

  #userInput {
    font-size: 15px;
  }

  #sendBtn {
    width: 38px;
    height: 38px;
  }

  .token {
    width: 104px;
    height: 104px;
  }
}

.small-rounded-chip {
  border-radius: 4px;
  font-size: 10px;
  background: var(--chip-bg);
  padding: 1px 3px;
  margin-left: 3px;
}