/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI',
               Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #00BFA5 0%, #00E5FF 35%, #00BFA5 65%, #009688 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Language toggle ─────────────────────────────────────────────────────── */
.lang-row {
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

[dir="rtl"] .lang-row { justify-content: flex-start; }

.lang-toggle {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 50px;
  padding: 8px 18px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.lang-toggle:hover { background: rgba(255,255,255,0.3); }

/* ── Loading screen ──────────────────────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: rgba(255,255,255,0.9);
  font-size: 15px;
  gap: 14px;
  width: 100%;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Not found screen ────────────────────────────────────────────────────── */
.not-found-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  text-align: center;
  width: 100%;
}

.nf-emoji  { font-size: 56px; margin-bottom: 16px; }

.not-found-screen h2 {
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 8px;
}

.not-found-screen p {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 24px;
}

.btn-home {
  display: inline-block;
  padding: 14px 32px;
  background: #000;
  color: #fff;
  border-radius: 50px;
  font-size: 15px;
  font-weight: bold;
  text-decoration: none;
}

/* ── Main page ───────────────────────────────────────────────────────────── */
.main-page {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 28px 20px 60px;
  min-height: 100vh;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFFFF 50%, #E0F7F5 80%, #B2DFDB 100%);
  border-radius: 24px;
  padding: 24px 20px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
}

/* ── Profile row ─────────────────────────────────────────────────────────── */
.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  justify-content: center;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00BFA5 0%, #009688 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  flex-shrink: 0;
}

.profile-info { display: flex; flex-direction: column; gap: 3px; }

.profile-username {
  font-size: 16px;
  font-weight: bold;
  color: #222;
  direction: ltr;
}

.profile-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: #444;
}

/* ── Textarea container ──────────────────────────────────────────────────── */
.textarea-container {
  position: relative;
  background: rgba(255,255,255,0.65);
  border: 2px solid rgba(0,191,165,0.15);
  border-radius: 16px;
  transition: border-color 0.25s;
}

.textarea-container:focus-within {
  border-color: rgba(0,191,165,0.5);
}

.message-textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px 16px 44px;
  border: none;
  outline: none;
  font-size: 16px;
  resize: none;
  font-family: inherit;
  background: transparent;
  color: #333;
  line-height: 1.6;
  transition: opacity 0.3s;
  border-radius: 16px;
}

.message-textarea::placeholder { color: rgba(0,0,0,0.3); }

/* ── Dice button ─────────────────────────────────────────────────────────── */
.dice-btn {
  position: absolute;
  bottom: 10px;
  inset-inline-end: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.07);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.dice-btn:hover {
  background: rgba(0,0,0,0.12);
  transform: scale(1.1);
}

@keyframes diceSpinAnim {
  from { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(0.9); }
  to   { transform: rotate(360deg) scale(1); }
}

.dice-btn.spin { animation: diceSpinAnim 0.45s ease; }

/* ── Meta row ────────────────────────────────────────────────────────────── */
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding: 0 2px;
  flex-direction: row-reverse; /* lock label at start (right in RTL), counter at end */
}

[dir="ltr"] .meta-row { flex-direction: row; }

.lock-label {
  font-size: 13px;
  color: rgba(0,0,0,0.35);
}

.char-count {
  font-size: 12px;
  color: rgba(0,0,0,0.25);
  direction: ltr;
  transition: color 0.2s;
}

.char-count.count-orange { color: #FF9800; font-weight: 600; }
.char-count.count-red    { color: #FF3B30; font-weight: 600; }

/* ── Success card ────────────────────────────────────────────────────────── */
.success-card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 28px;
  gap: 14px;
}

@keyframes popIn {
  0%   { transform: scale(0.7); opacity: 0; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.success-card.pop-in { animation: popIn 0.4s ease forwards; }

.success-checkmark { font-size: 56px; }

.success-title {
  font-size: 20px;
  font-weight: bold;
  color: #222;
  text-align: center;
}

/* ── Send button ─────────────────────────────────────────────────────────── */
.btn-send {
  display: block;
  width: 100%;
  max-width: 500px;
  padding: 17px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  margin-top: 16px;
  transition: transform 0.1s, opacity 0.2s;
}

.btn-send:hover  { opacity: 0.88; }
.btn-send:active { transform: scale(0.98); }
.btn-send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Send again button ───────────────────────────────────────────────────── */
.btn-again {
  display: inline-block;
  padding: 13px 32px;
  background: rgba(0,191,165,0.12);
  color: #00897B;
  border: 2px solid #00BFA5;
  border-radius: 50px;
  font-size: 15px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-again:hover { background: rgba(0,191,165,0.2); }

/* ── Social proof ────────────────────────────────────────────────────────── */
.social-proof {
  margin: 28px 0 16px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
  text-align: center;
}

/* ── Download CTA ────────────────────────────────────────────────────────── */
.btn-download {
  display: block;
  width: 100%;
  max-width: 500px;
  padding: 18px 32px;
  background: #000;
  color: #fff;
  border-radius: 50px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-download:hover { opacity: 0.85; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.page-footer {
  margin-top: 20px;
  padding-bottom: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

.page-footer a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: color 0.2s;
}
.page-footer a:hover { color: rgba(255,255,255,0.8); }

/* ── Shake animation ─────────────────────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.shake { animation: shake 0.35s ease; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 400px) {
  .main-page { padding: 20px 12px 50px; }
  .card      { border-radius: 18px; padding: 18px 14px 16px; }
}
