/* SafeLoop – shared tokens & components */

@font-face { font-family: "Fredoka"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/fredoka-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
  --ink: #1E2A36;
  --ink-2: #4A5A68;
  --ink-3: #8595A3;
  --paper: #F4F8F7;
  --card: #FFFFFF;
  --line: #DCE7E6;
  --line-2: #EDF3F2;
  --loop: #1D7A85;
  --loop-deep: #155D66;
  --loop-tint: #DDF0F1;
  --loop-soft: #EAF5F6;
  --spark: #FFC83D;
  --spark-deep: #D99B00;
  --spark-tint: #FFF1C6;
  --spark-soft: #FFF8E3;
  --ok: #2E9E6B;
  --bad: #D64545;
  --bad-tint: #FDECEC;
  --radius: 18px;
  --radius-s: 12px;
  --shadow: 0 8px 30px rgba(30, 42, 54, .08);
  --shadow-s: 0 2px 8px rgba(30, 42, 54, .06);
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--loop); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--spark); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 14px; border: 2px solid transparent;
  font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: .01em;
  cursor: pointer; text-decoration: none !important; transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
  user-select: none; -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: var(--loop); color: #fff; box-shadow: 0 4px 14px rgba(29, 122, 133, .28); }
.btn-primary:hover { background: var(--loop-deep); }
.btn-spark { background: var(--spark); color: var(--ink); box-shadow: 0 4px 14px rgba(255, 200, 61, .35); }
.btn-spark:hover { background: #FFD65E; }
.btn-ghost { background: transparent; color: var(--loop); border-color: var(--loop-tint); }
.btn-ghost:hover { background: var(--loop-soft); }
.btn-plain { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-plain:hover { background: var(--line-2); }
.btn-danger { background: var(--bad-tint); color: var(--bad); }
.btn-danger:hover { background: #FBDCDC; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 15px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: transparent; border: 0; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: var(--line-2); color: var(--ink); }
.btn-icon svg { width: 22px; height: 22px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: 14px; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); }
.input, input[type=text], input[type=email], input[type=password], input[type=tel], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--radius-s);
  background: #fff; font-size: 16px; transition: border-color .15s ease;
}
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--loop); outline: none; }
input.code { font-family: var(--display); font-size: 28px; letter-spacing: .4em; text-align: center; padding-left: .4em; }
.form-error { background: var(--bad-tint); color: #8A1F1F; border-radius: var(--radius-s); padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.form-ok { background: #E6F6EE; color: #1B6B45; border-radius: var(--radius-s); padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }

/* Cards & layout helpers */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-s); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.eyebrow { font-family: var(--body); font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--loop); }

/* Logo mark: two linked loops */
.mark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--ink); text-decoration: none !important; }
.mark svg { width: 34px; height: 34px; }

/* Avatar with initial */
.avatar { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 20px; color: #fff; flex-shrink: 0; position: relative; }
.avatar.lg { width: 72px; height: 72px; font-size: 32px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: var(--ink-3); border: 2px solid #fff; }
.avatar .dot.on { background: var(--ok); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 42, 54, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; animation: fade .15s ease; }
.modal { background: var(--card); border-radius: 24px 24px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 22px 20px calc(22px + var(--safe-bottom)); animation: rise .2s ease; }
.modal h2 { font-size: 22px; margin-bottom: 8px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn { flex: 1; }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 24px; }
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); animation: rise .2s ease; max-width: calc(100% - 32px); text-align: center; }
.toast.err { background: var(--bad); }

/* Menus */
.menu { position: absolute; right: 8px; top: 52px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 240px; padding: 6px; z-index: 40; animation: fade .12s ease; }
.menu button { display: block; width: 100%; text-align: left; padding: 11px 14px; background: none; border: 0; border-radius: 10px; font-weight: 600; cursor: pointer; }
.menu button:hover { background: var(--line-2); }
.menu button.danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }

/* Language switch */
.lang-switch { display: inline-flex; gap: 2px; background: var(--line-2); border-radius: 999px; padding: 3px; }
.lang-switch a, .lang-switch button { font-family: var(--body); font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; color: var(--ink-2); border: 0; background: transparent; cursor: pointer; text-decoration: none !important; }
.lang-switch .on { background: #fff; color: var(--ink); box-shadow: var(--shadow-s); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
