:root {

  --bg: #fdf6f9;
  --card: #ffffff;
  --surface: #ffffff;
  --surface-variant: #fce7f0;
  --text: #3d2a35;
  --muted: #8a6b78;
  --border: #f0d4e0;
  --outline: #e879a9;
  --accent: #e879a9;
  --accent-dark: #c45a8a;
  --accent-soft: #fce7f0;
  --accent-light: #fce7f0;
  --primary: #e879a9;
  --on-primary: #ffffff;

  --shadow: 0 1px 2px rgba(232, 121, 169, 0.12), 0 1px 3px 1px rgba(232, 121, 169, 0.08);
  --shadow-elevated: 0 2px 6px rgba(232, 121, 169, 0.15), 0 4px 12px 2px rgba(232, 121, 169, 0.1);

  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 24px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --transition: 200ms cubic-bezier(0.2, 0, 0, 1);}

[data-who="boy"] {

  --bg: #f4f8fc;
  --card: #ffffff;
  --surface: #ffffff;
  --surface-variant: #e3f0fa;
  --text: #2a3540;
  --muted: #6b7c8a;
  --border: #cfe0f0;
  --outline: #5b9fd4;
  --accent: #5b9fd4;
  --accent-dark: #3d7eb0;
  --accent-soft: #e3f0fa;
  --accent-light: #e3f0fa;
  --primary: #5b9fd4;

  --shadow: 0 1px 2px rgba(91, 159, 212, 0.12), 0 1px 3px 1px rgba(91, 159, 212, 0.08);
  --shadow-elevated: 0 2px 6px rgba(91, 159, 212, 0.15), 0 4px 12px 2px rgba(91, 159, 212, 0.1);}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background-image:
    radial-gradient(circle at 18% 25%, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 42%),
    radial-gradient(circle at 82% 75%, color-mix(in srgb, var(--accent) 14%, transparent) 0%, transparent 42%);
  position: relative;
  overflow-x: hidden;
}
.deco {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  animation: float 7s ease-in-out infinite;
  font-size: 1.35rem;
}
.deco:nth-child(1) { top: 6%; left: 5%; animation-delay: 0s; }
.deco:nth-child(2) { top: 12%; right: 7%; animation-delay: 1.1s; }
.deco:nth-child(3) { bottom: 14%; left: 8%; animation-delay: 2s; }
.deco:nth-child(4) { bottom: 9%; right: 10%; animation-delay: 0.6s; }
.deco:nth-child(5) { top: 48%; left: 3%; animation-delay: 1.7s; }
.deco:nth-child(6) { top: 58%; right: 4%; animation-delay: 2.5s; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}

.card {
  width: min(100%, 440px);
  height: min(94dvh, 780px);
  background: var(--card);
  border-radius: 22px;
  border: 12px solid color-mix(in srgb, var(--accent) 14%, white);
  box-shadow: 0 18px 44px var(--shadow);
  overflow: hidden;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .card {
    width: min(78vw, 520px);
    height: min(86dvh, 820px);
  }
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, white) 0%, #fff 48%);
  min-height: 100%;
  height: 100%;

  transform: translateZ(0);
}

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 18px 40px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
}
.stage.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 10;
}

.gif-wrap {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  flex-shrink: 0;

  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: transform;
  isolation: isolate;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.gif-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
  user-select: none;
  -webkit-user-drag: none;

}

.title {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  margin-bottom: 4px;
}
.subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 18px;
}

.letter-clickable {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  outline: none;
  max-width: 100%;
}
.letter-clickable:active .gif-wrap { transform: scale(0.96); }
#stage-letter .gif-wrap {
  max-width: 180px;
  transition: transform 0.2s ease;
}
.letter-hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 6px;
  animation: pulse 1.8s ease-in-out infinite;
}
.from-name {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 10px;
  opacity: 0.85;
}
@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.btn-area {
  position: relative;
  width: 100%;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.btn {
  border: none;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.3s ease,
              width 0.3s ease, height 0.3s ease, font-size 0.3s ease;
  font-family: inherit;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.96); }

.btn-yes {
  background: var(--accent);
  color: white;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  font-size: 1.15rem;
  box-shadow: 0 8px 22px var(--shadow);
  z-index: 5;
  position: relative;
}
.btn-yes:hover { background: var(--accent-dark); }

.btn-no {
  background: white;
  color: var(--accent);
  border: 2px solid var(--accent);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  position: absolute;
  z-index: 15;
  white-space: nowrap;
  max-width: 160px;
  transition:
    left 0.4s cubic-bezier(0.34, 1.4, 0.64, 1),
    top 0.4s cubic-bezier(0.34, 1.4, 0.64, 1),
    transform 0.3s ease, opacity 0.3s ease,
    font-size 0.3s ease, padding 0.3s ease;
}
.btn-no.no-disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  pointer-events: auto;
}

.float-emoji {
  position: absolute;
  font-size: 1.6rem;
  pointer-events: none;
  z-index: 40;
  animation: floatUp 1.1s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes floatUp {
  0%   { opacity: 1; transform: translate(-50%, 0) scale(0.85); }
  100% { opacity: 0; transform: translate(-50%, -55px) scale(1.6); }
}

.forced-banner {
  background: white;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  margin-bottom: 8px;
  white-space: nowrap;
}
.forced-banner span { color: var(--accent); }

.big-yes {
  font-size: 3.4rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 35%, white);
  letter-spacing: -2px;
  margin: 6px 0 4px;
  animation: pop 0.45s cubic-bezier(0.34, 1.5, 0.64, 1);
}
@keyframes pop {
  0% { transform: scale(0.25); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.confirm-btn {
  background: var(--accent);
  color: white;
  width: 100%;
  max-width: 240px;
  padding: 14px;
  border-radius: 14px;
  font-size: 1.05rem;
  margin-top: 16px;
  box-shadow: 0 8px 20px var(--shadow);
  position: relative;
  z-index: 100;
  cursor: pointer;
}
.confirm-btn:hover { background: var(--accent-dark); }

.picker-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 12px 0 6px;
  align-self: flex-start;
  width: 100%;
  max-width: 300px;
}
.days {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 300px;
}
.day-btn {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: white;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  transition: all 0.15s;
  font-family: inherit;
}
.day-btn small {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 500;
}
.day-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.day-btn.selected small { color: rgba(255,255,255,0.85); }

.period-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  width: 100%;
  max-width: 300px;
  justify-content: center;
}
.period-btn {
  flex: 1;
  padding: 7px 2px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: white;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.period-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.times {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  width: 100%;
  max-width: 300px;
}
.time-btn {
  padding: 9px 12px;
  border-radius: 11px;
  border: 2px solid var(--border);
  background: white;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.time-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.next-btn {
  background: var(--accent);
  color: white;
  width: 100%;
  max-width: 270px;
  padding: 14px;
  border-radius: 14px;
  font-size: 1rem;
  margin-top: 18px;
  box-shadow: 0 8px 20px var(--shadow);
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.2s;
}
.next-btn.enabled {
  opacity: 1;
  pointer-events: auto;
}

.activities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 290px;
  margin-top: 4px;
}
.act-btn {
  background: white;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  font-family: inherit;
}
.act-btn .act-emoji { font-size: 1.65rem; }
.act-btn.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.custom-input {
  width: 100%;
  max-width: 290px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
  font-family: inherit;
}
.custom-input:focus { border-color: var(--accent); }

.char-hint {
  font-size: 0.75rem;
  color: var(--muted);
  align-self: flex-end;
  max-width: 290px;
  width: 100%;
  text-align: right;
  margin-top: 3px;
}

.final-msg {
  font-size: 1.05rem;
  text-align: center;
  line-height: 1.5;
  margin: 10px 0 16px;
  max-width: 270px;
}
.final-msg strong { color: var(--accent); }

#confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(90px);
  background: #1a1a1a;
  color: white;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  z-index: 50;
  opacity: 0;
  transition: all 0.35s ease;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-height: 620px) {
  .gif-wrap { max-width: 150px; margin-bottom: 6px; }
  .title { font-size: 1.1rem; }
  .btn-yes { width: 90px; height: 90px; font-size: 1.05rem; }
  .big-yes { font-size: 2.8rem; }
  .btn-area { min-height: 150px; }
}

.no-counter {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  animation: fadeIn 0.25s ease;
}
.no-phrase {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--accent-dark);
  text-align: center;
  font-weight: 600;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

#stage-refused {
  overflow: hidden;
  text-align: center;
}
.refuse-emoji {
  font-size: 3.2rem;
  margin-bottom: 8px;
  animation: sadBounce 1.4s ease infinite;
}
@keyframes sadBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.refuse-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.refuse-sub {
  font-size: 0.88rem;
  color: var(--muted);
}
.cry-rain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.cry-drop {
  position: absolute;
  bottom: -40px;
  animation-name: cryUp;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  opacity: 0.85;
}
@keyframes cryUp {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.7; }
  100% { transform: translateY(-340px) rotate(15deg); opacity: 0; }
}

.extra-msg-box {
  margin-top: 16px;
  width: 100%;
  text-align: left;
  background: var(--accent-light);
  border-radius: 14px;
  padding: 12px;
  box-sizing: border-box;
}
.extra-msg-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
#extra-msg {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  resize: none;
  background: #fff;
  color: var(--text);
}
#extra-msg:focus {
  outline: none;
  border-color: var(--accent);
}
#extra-char {
  align-self: auto;
  max-width: none;
  width: 100%;
  text-align: center;
  margin: 6px 0 0;
}
#btn-extra-send {
  margin: 10px auto 0;
  width: 100%;
  max-width: 270px;
  min-height: 44px;
  white-space: normal;
  line-height: 1.2;
}
#btn-extra-send:not(.enabled):not(:disabled) {
  opacity: 1;
  pointer-events: auto;
}

svg.ic {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  vertical-align: -0.2em;
  fill: currentColor;
  flex-shrink: 0;
  pointer-events: none;
}
