:root {
  --accent: #10b981;
  --accent-dark: #059669;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --bg-grad-1: #0f172a;
  --bg-grad-2: #1e293b;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --input-bg: #f8fafc;
  --shadow: 0 20px 60px -15px rgba(2, 6, 23, 0.55);
  --radius: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px 18px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% -10%, #334155 0%, transparent 55%),
              radial-gradient(1000px 700px at 110% 10%, #0e7490 0%, transparent 45%),
              linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 440px;                 /* mobile / narrow default */
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 28px 28px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: max-width 0.2s ease;
}

/* Header */
.card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.card__heading { flex: 1; min-width: 0; }

.logo {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 14px;
  box-shadow: 0 8px 20px -6px var(--accent-dark);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  padding: 0 4px;
  overflow: hidden;
}

.card__header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 3px;
}

/* Currency selector */
.currency-select {
  flex: 0 0 auto;
  position: relative;
  display: inline-flex;
  align-items: center;
}
.currency-select::after {
  content: "";
  position: absolute;
  right: 10px;
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}
.currency-select select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 28px 8px 12px;
  cursor: pointer;
}
.currency-select select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Body layout ---------- */
.card__body {
  display: grid;
  grid-template-columns: 1fr;       /* stacked by default (mobile) */
  gap: 22px;
}

.inputs { display: flex; flex-direction: column; }

/* Fields */
.field { margin-bottom: 22px; }
.field:last-child { margin-bottom: 0; }

.field > label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.input-prefix,
.input-suffix {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1.05rem;
  pointer-events: none;
}
.input-prefix { padding-left: 16px; }
.input-suffix { padding-right: 16px; }

.input-wrap input {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 13px 16px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-family: inherit;
}
.input-wrap input::placeholder { color: #cbd5e1; font-weight: 500; }
.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Tip grid */
.tip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.tip-btn {
  padding: 13px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: #334155;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.tip-btn:hover { background: #475569; }
.tip-btn:active { transform: scale(0.96); }
.tip-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 8px 18px -8px var(--accent-dark);
}
.input-wrap--custom { grid-column: span 2; }
.input-wrap--custom input { text-align: center; padding-right: 4px; }

/* Split */
.split-row { display: flex; flex-direction: column; gap: 10px; }
.split-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.people-btn {
  padding: 11px 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  background: var(--input-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}
.people-btn:hover { border-color: var(--accent); }
.people-btn:active { transform: scale(0.96); }
.people-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-color: transparent;
  color: #fff;
}
.input-wrap--people { max-width: 150px; }
.input-wrap--people input { text-align: left; padding-left: 8px; }
.people-icon { width: 20px; height: 20px; color: var(--text-muted); margin-left: 14px; flex: 0 0 auto; }

.error-msg {
  color: #ef4444;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 8px;
}

/* Results */
.results {
  padding: 22px 20px 20px;
  background: linear-gradient(160deg, #0f172a, #1e293b);
  border-radius: var(--radius);
  color: #fff;
  display: flex;
  flex-direction: column;
}
.results__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.results__label { font-size: 0.9rem; font-weight: 600; }
.results__sub {
  display: block;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 2px;
}
.results__value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.results__grand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 16px;
  margin-bottom: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.9rem;
  font-weight: 600;
  color: #cbd5e1;
}
.results__grand span:last-child {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.reset-btn {
  margin-top: auto;
  width: 100%;
  padding: 13px 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.08s ease;
  font-family: inherit;
}
.reset-btn:hover { filter: brightness(1.08); }
.reset-btn:active { transform: scale(0.98); }

/* ---------- Ad slot ---------- */
.adslot {
  width: 100%;
  max-width: 440px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px dashed rgba(148,163,184,0.35);
  border-radius: var(--radius-sm);
  color: rgba(148,163,184,0.7);
  font-size: 0.8rem;
}

/* ---------- Site footer (links row) ---------- */
.site-footer {
  width: 100%;
  max-width: 760px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
  padding: 4px 6px 0;
  color: rgba(148, 163, 184, 0.75);
  font-size: 0.8rem;
}
.site-footer .copy { margin-right: auto; }
.site-footer a {
  color: rgba(203, 213, 225, 0.85);
  text-decoration: none;
  font-weight: 500;
}
.site-footer a:hover { color: #fff; text-decoration: underline; }

/* ---------- Document pages (About / Privacy) ---------- */
.doc {
  width: 100%;
  max-width: 720px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 34px 30px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.doc__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 22px;
}
.doc__brand .logo { width: 40px; height: 40px; font-size: 1.2rem; }
.doc__brand span { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.doc h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.doc .updated { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px; }
.doc h2 { font-size: 1.1rem; font-weight: 700; margin: 24px 0 8px; }
.doc p, .doc li { color: #334155; font-size: 0.96rem; line-height: 1.7; }
.doc p { margin-bottom: 12px; }
.doc ul { margin: 0 0 12px 20px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc .back {
  display: inline-block;
  margin-top: 24px;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
}
.doc .back:hover { filter: brightness(1.08); text-decoration: none; }

.doc .lead { font-size: 1.06rem; color: #475569; line-height: 1.7; }
.doc .callout {
  background: var(--accent-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 20px 0;
}
.doc .callout p { margin: 0; color: #0f766e; font-weight: 500; }
.doc .callout a { color: var(--accent-dark); }
.doc .table-wrap { overflow-x: auto; margin: 14px 0 20px; -webkit-overflow-scrolling: touch; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 480px; }
.doc th, .doc td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { color: var(--text); font-weight: 700; background: var(--input-bg); }
.doc td { color: #334155; line-height: 1.5; }
.doc td:first-child { font-weight: 600; color: var(--text); white-space: nowrap; }
.doc .faq h3 { font-size: 1.02rem; font-weight: 700; margin: 20px 0 4px; color: var(--text); }

@media (max-width: 440px) {
  .doc { padding: 24px 20px 22px; }
  .site-footer { justify-content: center; flex-wrap: wrap; gap: 12px; }
  .site-footer .copy { margin-right: 0; width: 100%; text-align: center; }
}

/* ---------- Desktop: two-column ---------- */
@media (min-width: 720px) {
  .card { max-width: 760px; padding: 34px 34px 30px; }
  .adslot { max-width: 760px; }
  .card__body {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 30px;
    align-items: stretch;
  }
  .results { min-height: 100%; }
  .card__header h1 { font-size: 1.55rem; }
}

/* ---------- Small phones ---------- */
@media (max-width: 440px) {
  .card { padding: 24px 20px 22px; }
  .card__header { gap: 10px; }
  .card__header h1 { font-size: 1.25rem; white-space: nowrap; }
  .logo { width: 44px; height: 44px; }
  .currency-select select { padding: 7px 26px 7px 10px; font-size: 0.78rem; }
  .results__value { font-size: 1.5rem; }
  .tip-btn { font-size: 1rem; }
}
