/* ===== Valentine Mini App — Telegram Theme Adaptive ===== */

:root {
  --bg:       var(--tg-theme-bg-color, #f5f5f5);
  --surface:  var(--tg-theme-secondary-bg-color, #ffffff);
  --text:     var(--tg-theme-text-color, #1a1a1a);
  --hint:     var(--tg-theme-hint-color, #999999);
  --link:     var(--tg-theme-link-color, #2481cc);
  --btn:      var(--tg-theme-button-color, #c96b5d);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --border:   rgba(0,0,0,.06);
  --accent:   #e8564a;
  --green:    #43a047;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Floating hearts ===== */
.hearts-bg {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
}
.floating-heart {
  position: absolute; bottom: -40px;
  opacity: .12;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  8%   { opacity: .12; }
  92%  { opacity: .12; }
  100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

/* ===== Loader ===== */
.loader {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; gap: 12px;
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
}
.loader__emoji { font-size: 48px; animation: pulse 1.2s ease-in-out infinite; }
.loader__text  { color: var(--hint); font-size: 14px; }
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.18); }
}

/* ===== App container ===== */
.app {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 32px);
}

/* ===== Profile ===== */
.profile {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 10px;
}
.profile__avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff8a65);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; flex-shrink: 0;
}
.profile__name   { font-size: 16px; font-weight: 600; }
.profile__handle  { font-size: 13px; color: var(--hint); }

/* ===== Tabs ===== */
.tabs {
  display: flex; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px; margin-bottom: 10px;
}
.tab {
  flex: 1; border: none; background: transparent;
  color: var(--hint);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 8px 4px; border-radius: 10px;
  cursor: pointer; transition: all .2s;
}
.tab.active {
  background: var(--btn); color: var(--btn-text);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* ===== Stats row ===== */
.stats-row {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 8px; margin-bottom: 10px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 6px; text-align: center;
}
.stat-card__value {
  display: block; font-size: 24px; font-weight: 700;
  color: var(--accent);
}
.stat-card__label {
  display: block; font-size: 10px; color: var(--hint);
  margin-top: 2px; text-transform: uppercase; letter-spacing: .05em;
}

/* ===== Link card ===== */
.link-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 14px;
  margin-bottom: 10px;
}
.link-card__label { font-size: 13px; color: var(--hint); margin-bottom: 8px; }
.link-card__url {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--link);
  word-break: break-all;
  line-height: 1.4;
  margin-bottom: 10px;
  -webkit-user-select: all;
  user-select: all;
}
.link-card__actions {
  display: flex; gap: 8px;
}
.link-card__hint {
  font-size: 12px; color: var(--green);
  margin-top: 6px; min-height: 18px;
}

/* ===== Section title ===== */
.section-title {
  display: flex; align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px; padding: 0 4px;
}
.section-title span  { font-size: 15px; font-weight: 600; }
.section-title small { font-size: 12px; color: var(--hint); }

/* ===== Valentine cards ===== */
.card-list { display: grid; gap: 8px; margin-bottom: 14px; }

.v-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 14px;
  transition: transform .1s;
  animation: cardIn .35s ease both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.v-card__text {
  font-size: 14px; line-height: 1.45;
  margin-bottom: 8px; word-break: break-word;
}
.v-card__footer {
  display: flex; justify-content: space-between;
  align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.v-card time        { font-size: 11px; color: var(--hint); }
.v-card__sender     { font-size: 12px; color: var(--link); font-weight: 500; }
.v-card__anon       { font-size: 12px; color: var(--hint); }
.v-card__recipient  { font-size: 12px; color: var(--link); font-weight: 500; }

/* ===== Card actions ===== */
.v-card__actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 6px;
}

/* ===== Reply form ===== */
.v-card__reply-form {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.reply-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit; font-size: 13px;
  background: var(--bg); color: var(--text);
  resize: vertical; min-height: 44px;
}
.reply-input:focus {
  outline: none;
  border-color: var(--btn);
}

/* ===== Reply bubbles ===== */
.v-card__replies {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 6px;
}
.reply-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px; line-height: 1.4;
  max-width: 85%;
}
.reply-bubble p { margin-bottom: 2px; word-break: break-word; }
.reply-bubble time { font-size: 10px; color: var(--hint); }
.reply-bubble--mine {
  background: var(--btn);
  color: var(--btn-text);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.reply-bubble--mine time { color: rgba(255,255,255,.6); }
.reply-bubble--other {
  background: var(--bg);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.reply-empty {
  font-size: 12px; color: var(--hint);
  text-align: center; padding: 8px 0;
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center; padding: 32px 16px; color: var(--hint);
}
.empty-state__emoji { font-size: 40px; margin-bottom: 8px; }
.empty-state p      { font-size: 14px; }

/* ===== Auth prompt ===== */
.auth-prompt {
  text-align: center; padding: 40px 16px;
}
.auth-prompt__emoji { font-size: 48px; margin-bottom: 12px; }
.auth-prompt h3     { font-size: 18px; margin-bottom: 8px; }
.auth-prompt p      { color: var(--hint); font-size: 14px; margin-bottom: 20px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; padding: 10px 20px;
  border-radius: 12px; font: inherit;
  font-weight: 600; font-size: 14px;
  border: none; cursor: pointer;
  transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.95); }
.btn--primary { background: var(--btn); color: var(--btn-text); }
.btn--accent  { background: var(--accent); color: #fff; }
.btn--outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost {
  background: transparent; color: var(--hint);
  padding: 6px 10px; font-size: 12px;
}
.btn--block { display: flex; width: 100%; justify-content: center; margin-top: 14px; }
.btn--small {
  padding: 8px 14px; font-size: 13px;
  border-radius: 10px;
}
.btn--xs {
  padding: 5px 10px; font-size: 12px;
  border-radius: 8px; font-weight: 500;
}

/* ===== Info card ===== */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 24px 16px;
  text-align: center; margin-bottom: 10px;
}
.info-card__emoji { font-size: 48px; margin-bottom: 12px; }
.info-card h2     { font-size: 20px; margin-bottom: 8px; }
.info-card p      { color: var(--hint); font-size: 14px; margin-bottom: 20px; max-width: 320px; margin-inline: auto; }

.info-features {
  text-align: left; max-width: 300px;
  margin: 0 auto 16px;
}
.info-feature {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.info-feature:last-child { border-bottom: none; }

/* ===== Compliment generator ===== */
.compliment-card {
  background: linear-gradient(135deg, #fff5f0, var(--surface));
  border: 1px solid var(--border);
  border-radius: 16px; padding: 20px 16px;
  text-align: center; margin-bottom: 10px;
}
.compliment-card h3    { font-size: 17px; margin-bottom: 4px; }
.compliment-card__sub  { font-size: 13px; color: var(--hint); margin-bottom: 16px; }
.compliment-card__text {
  font-size: 18px; font-weight: 500;
  padding: 16px 12px; min-height: 60px;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s;
  color: var(--accent);
}
.compliment-card__actions {
  display: flex; gap: 8px; justify-content: center; margin-top: 12px;
}

/* ===== Responsive ===== */
@media (max-width: 380px) {
  .stats-row { gap: 4px; }
  .stat-card { padding: 10px 4px; }
  .stat-card__value { font-size: 20px; }
  .tab { font-size: 12px; padding: 6px 2px; }
  .v-card__actions { gap: 4px; }
  .btn--xs { padding: 4px 8px; font-size: 11px; }
}
