:root{
  --bg:#0b0c0f;
  --bg2:#08090c;
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.58);

  --line:rgba(255,255,255,.10);
  --card:rgba(255,255,255,.035);

  --accent:#2ea6ff;
  --accentSoft:rgba(46,166,255,.18);
  --accentGlow:rgba(46,166,255,.35);
  --ok:#44ff9a;
  --warn:#ffd24d;
  --err:#ff5c7a;
  --premium:#ffb800;
  --premiumGlow:rgba(255,184,0,.25);

  --shadow:0 18px 45px rgba(0,0,0,.55);
  --shadowSoft:0 10px 30px rgba(0,0,0,.35);
  --shadowHard:0 24px 60px rgba(0,0,0,.70);

  --radius:18px;
  --radius2:16px;
  --radius3:14px;
}

html[data-theme="light"]{
  --bg:#eff0f4;
  --bg2:#f6f7fb;
  --text:rgba(0,0,0,.88);
  --muted:rgba(0,0,0,.48);

  --line:rgba(0,0,0,.08);
  --card:rgba(255,255,255,.94);

  --accent:#007aff;
  --accentSoft:rgba(0,122,255,.14);
  --accentGlow:rgba(0,122,255,.28);
  --ok:#34c759;
  --warn:#ff9500;
  --err:#ff3b30;
  --premium:#ff9500;
  --premiumGlow:rgba(255,149,0,.22);

  --shadow:0 10px 26px rgba(0,0,0,.08);
  --shadowSoft:0 8px 20px rgba(0,0,0,.06);
  --shadowHard:0 16px 40px rgba(0,0,0,.12);
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,SF Pro Text,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;

  background:
    radial-gradient(900px 500px at 50% -120px, rgba(46,166,255,.14), transparent 55%),
    radial-gradient(900px 600px at 80% 110%, rgba(46,166,255,.08), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}

.app{
  max-width:560px;
  margin:0 auto;
  padding:14px 14px 24px;
}

/* ---------- header ---------- */
.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.brand{display:flex;align-items:center;gap:10px;min-width:0}
.brand__icon{
  width:34px;height:34px;border-radius:14px;
  display:grid;place-items:center;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  box-shadow:var(--shadowSoft);
}
.brand__text{display:flex;flex-direction:column;gap:2px;min-width:0}
.brand__title{font-weight:700;letter-spacing:.2px;font-size:15px}
.brand__subtitle{color:var(--muted);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.header__actions{display:flex;align-items:center;gap:10px}

/* ---------- tabs ---------- */
.tabs{
  position:relative;
  padding:8px;
  border-radius:22px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.035);
  box-shadow:var(--shadow);
  display:flex;
  gap:8px;
  margin-bottom:14px;
  overflow:hidden;
}

.tabs__btn{
  flex:1 1 0;
  height:40px;
  border:1px solid transparent;
  border-radius:14px;
  background:transparent;
  color:var(--muted);
  font-weight:600;
  font-size:14px;
  cursor:pointer;
  position:relative;
  z-index:2;

  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  padding:0 10px;
  white-space:nowrap;
  transition:color .15s ease;
}
.tabs__btn.is-active{
  color:var(--text);
}
.tabs__btn:hover{color:var(--text)}

.tabs__indicator{
  position:absolute;
  left:8px;
  top:8px;
  height:40px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.07);
  z-index:1;
  transition:transform .18s cubic-bezier(.4,0,.2,1),width .18s cubic-bezier(.4,0,.2,1);
  will-change:transform,width;
}

/* ---------- panels / typography ---------- */
.main{min-height:220px}
.panel{display:none}
.panel.is-active{display:block}

.h1{
  margin:12px 2px 14px;
  font-size:28px;
  line-height:1.15;
  letter-spacing:-.6px;
  font-weight:700;
}

/* ---------- cards ---------- */
.card{
  border-radius:var(--radius);
  border:1px solid var(--line);
  background:var(--card);
  box-shadow:var(--shadow);
  overflow:hidden;
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
}
.card__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:14px 14px 8px;
}
.card__title{
  font-size:17px;
  font-weight:600;
}
.card__body{padding:16px}

.card__row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 14px 12px;
}

.card--inner{
  border-radius:var(--radius2);
  border:1px solid rgba(255,255,255,.09);
  background:rgba(255,255,255,.03);
  box-shadow:none;
}

/* ---------- tools ---------- */
.toolgrid{display:flex;flex-direction:column;gap:12px}
.toolcard{padding-bottom:10px}

.tag{
  padding:5px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  font-weight:600;
  color:var(--text);
  font-size:12px;
  letter-spacing:.3px;
}

.input{
  flex:1 1 auto;
  min-width:0;
  height:46px;
  padding:0 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.16);
  color:var(--text);
  outline:none;
  font-size:15px;
  transition:all .2s ease;
}
.input::placeholder{color:rgba(255,255,255,.30)}
.input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accentSoft);
}

.btn{
  height:46px;
  padding:0 16px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:600;
  font-size:15px;
  cursor:pointer;
  white-space:nowrap;
  transition:all .2s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
}
.btn:hover{
  border-color:rgba(255,255,255,.20);
  transform:translateY(-1px);
}
.btn:active{transform:translateY(0)}
.btn:disabled{opacity:.5;cursor:not-allowed;transform:none}

.btn--primary{
  background:var(--accentSoft);
  border-color:rgba(46,166,255,.26);
  color:var(--accent);
}
.btn--primary:hover{
  border-color:rgba(46,166,255,.40);
  background:rgba(46,166,255,.24);
  box-shadow:0 4px 12px rgba(46,166,255,.20);
}

.btn--secondary{
  background:rgba(255,255,255,.05);
  border-color:rgba(255,255,255,.10);
  flex:1;
}
.btn--secondary:hover{
  background:rgba(255,255,255,.08);
  border-color:rgba(255,255,255,.18);
}

.btn--premium{
  background:linear-gradient(135deg, var(--premium) 0%, #ff9500 100%);
  border:none;
  color:#000;
  font-weight:700;
  box-shadow:0 8px 20px var(--premiumGlow);
  width:100%;
}
.btn--premium:hover{
  box-shadow:0 12px 28px var(--premiumGlow);
  transform:translateY(-2px);
}

.btn--ghost{background:rgba(255,255,255,.04)}
.btn--mini{
  height:32px;
  border-radius:12px;
  padding:0 12px;
  font-size:13px;
}

/* прогресс */
.progress{display:none;padding:0 14px 10px}
.toolcard.is-progress .progress{display:block}
.progress__bar{
  height:8px;
  border-radius:999px;
  background:var(--accent);
  width:0%;
  transition:width .18s ease;
  box-shadow:0 0 12px var(--accentGlow);
}

.result{padding:0 14px 14px}
.result__line{font-size:14px}
.muted{color:var(--muted)}
.small{font-size:13px}

/* ---------- recent ---------- */
.recentlist{display:flex;flex-direction:column;gap:12px}

.recentitem{
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.12);
  padding:12px;

  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
  transition:all .2s ease;
}
.recentitem:hover{
  border-color:rgba(255,255,255,.18);
  background:rgba(0,0,0,.16);
}
.recentitem__main{min-width:0}
.recentitem__title{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:600;
}
.recentitem__sub{
  margin-top:6px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  font-size:13px;
}
.dot{opacity:.55}
.recentitem__actions{
  display:inline-flex;
  align-items:center;
  gap:10px;
  white-space:nowrap;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
}
.pill--done{border-color:rgba(68,255,154,.20); background:rgba(68,255,154,.10); color:var(--ok)}
.pill--err{border-color:rgba(255,92,122,.22); background:rgba(255,92,122,.10); color:var(--err)}
.pill--run{border-color:rgba(46,166,255,.24); background:rgba(46,166,255,.10); color:var(--accent)}
.pill--q{border-color:rgba(255,210,77,.22); background:rgba(255,210,77,.10); color:var(--warn)}

.iconbtn{
  width:42px;height:42px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
  display:grid;
  place-items:center;
  font-size:18px;
  transition:all .2s ease;
}
.iconbtn:hover{
  border-color:rgba(255,255,255,.20);
  transform:translateY(-1px);
}
.iconbtn:active{transform:translateY(0)}
.iconbtn:disabled{opacity:.5;cursor:not-allowed;transform:none}
.iconbtn--danger{border-color:rgba(255,92,122,.18)}
.iconbtn--danger:hover{border-color:rgba(255,92,122,.30)}
.iconbtn--header{
  width:40px;height:40px;
  font-size:17px;
}

/* ========== PROFILE ========== */
.profile{
  display:flex;
  flex-direction:column;
  gap:12px;
}

/* Hero Card */
.profile-hero{
  position:relative;
  padding:0;
  overflow:hidden;
  min-height:200px;
  display:flex;
  align-items:flex-end;
}

.profile-hero__bg{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 30% 20%, var(--accentGlow), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(138,92,246,.15), transparent 50%),
    linear-gradient(135deg, rgba(46,166,255,.08) 0%, rgba(138,92,246,.08) 100%);
  opacity:.7;
}

.profile-hero__content{
  position:relative;
  width:100%;
  padding:20px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  text-align:center;
}

.profile-hero__avatar{
  width:72px;
  height:72px;
  border-radius:20px;
  background:rgba(255,255,255,.10);
  border:2px solid rgba(255,255,255,.15);
  display:grid;
  place-items:center;
  font-size:32px;
  box-shadow:0 8px 24px rgba(0,0,0,.30);
  margin-bottom:4px;
}

.profile-hero__name{
  font-size:22px;
  font-weight:700;
  letter-spacing:-.3px;
}

.profile-hero__username{
  font-size:15px;
  margin-bottom:8px;
}

.profile-hero__badge{
  padding:6px 14px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  letter-spacing:.5px;
  background:rgba(46,166,255,.18);
  border:1px solid rgba(46,166,255,.30);
  color:var(--accent);
  box-shadow:0 4px 12px rgba(46,166,255,.25);
}

.profile-hero__badge.is-premium{
  background:linear-gradient(135deg, var(--premium), #ff9500);
  border:1px solid rgba(255,184,0,.40);
  color:#000;
  box-shadow:0 6px 16px var(--premiumGlow);
}

/* Usage Card */
.usage-card{
  padding:18px;
}

.usage-card__header{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:16px;
}

.usage-card__icon{
  width:36px;
  height:36px;
  border-radius:12px;
  background:var(--accentSoft);
  display:grid;
  place-items:center;
  font-size:18px;
}

.usage-card__title{
  font-size:17px;
  font-weight:600;
}

.usage-stats__main{
  text-align:center;
  margin-bottom:20px;
}

.usage-stats__value{
  font-size:42px;
  font-weight:700;
  letter-spacing:-1px;
  line-height:1;
  margin-bottom:6px;
}

.usage-stats__divider{
  color:var(--muted);
  margin:0 4px;
}

.usage-stats__label{
  font-size:14px;
}

.usage-progress{
  margin-bottom:18px;
}

.usage-progress__track{
  height:12px;
  border-radius:999px;
  background:rgba(255,255,255,.08);
  overflow:hidden;
  margin-bottom:8px;
  border:1px solid rgba(255,255,255,.10);
}

.usage-progress__fill{
  height:100%;
  width:0%;
  background:linear-gradient(90deg, var(--accent), var(--accentGlow));
  border-radius:999px;
  transition:width .3s cubic-bezier(.4,0,.2,1);
  box-shadow:0 0 12px var(--accentGlow);
}

.usage-progress__label{
  display:flex;
  justify-content:space-between;
  font-size:13px;
  color:var(--muted);
}

.usage-progress__count{
  font-weight:600;
  color:var(--text);
}

/* Premium Card */
.premium-card{
  position:relative;
  padding:20px;
  background:linear-gradient(135deg, rgba(255,184,0,.12), rgba(255,149,0,.08));
  border-color:rgba(255,184,0,.25);
  overflow:hidden;
}

.premium-card__glow{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 20% 30%, var(--premiumGlow), transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(255,149,0,.15), transparent 60%);
  animation:premiumPulse 4s ease-in-out infinite;
}

@keyframes premiumPulse{
  0%,100%{opacity:.5}
  50%{opacity:.8}
}

.premium-card__content{
  position:relative;
  text-align:center;
}

.premium-card__icon{
  font-size:32px;
  margin-bottom:8px;
}

.premium-card__title{
  font-size:20px;
  font-weight:700;
  margin-bottom:6px;
  background:linear-gradient(135deg, var(--premium), #ff9500);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}

.premium-card__until{
  font-size:14px;
  display:flex;
  justify-content:center;
  gap:6px;
}

/* Referrals Card */
.refs-card{
  padding:18px;
}

.refs-card__header{
  display:flex;
  align-items:flex-start;
  gap:12px;
  margin-bottom:16px;
}

.refs-card__icon{
  width:40px;
  height:40px;
  border-radius:14px;
  background:linear-gradient(135deg, rgba(138,92,246,.15), rgba(99,102,241,.12));
  display:grid;
  place-items:center;
  font-size:20px;
  flex-shrink:0;
}

.refs-card__title{
  font-size:17px;
  font-weight:600;
  margin-bottom:2px;
}

.refs-card__subtitle{
  font-size:13px;
}

.refs-stats{
  display:flex;
  gap:12px;
  margin-bottom:16px;
}

.refs-stat{
  flex:1;
  padding:14px;
  border-radius:14px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  text-align:center;
}

.refs-stat__value{
  font-size:28px;
  font-weight:700;
  margin-bottom:4px;
  color:var(--accent);
}

.refs-stat__label{
  font-size:12px;
}

.refs-link{
  margin-bottom:12px;
  padding:12px;
  border-radius:12px;
  background:rgba(0,0,0,.20);
  border:1px solid rgba(255,255,255,.10);
}

.refs-link__text{
  font-size:13px;
  font-family:ui-monospace,SFMono-Regular,Monaco,Consolas,monospace;
  color:var(--accent);
  word-break:break-all;
  line-height:1.5;
}

.refs-actions{
  display:flex;
  gap:10px;
}

/* Settings Card */
.settings-card{
  padding:18px;
}

.settings-card__title{
  font-size:17px;
  font-weight:600;
  margin-bottom:12px;
}

.setting-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 0;
  border-bottom:1px solid rgba(255,255,255,.06);
}

.setting-row:last-child{
  border-bottom:none;
}

.setting-row__label{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:15px;
  font-weight:500;
}

.setting-row__icon{
  font-size:18px;
}

/* segmented mini */
.segmini{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px;
  border-radius:12px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
}

.segmini__btn{
  height:32px;
  min-width:52px;
  padding:0 14px;
  border-radius:10px;
  border:none;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  font-weight:600;
  font-size:13px;
  position:relative;
  z-index:2;
  white-space:nowrap;
  transition:color .15s ease;
}

.segmini__btn.is-active{
  color:var(--text);
}

.segmini__btn:hover{color:var(--text)}

.segmini__indicator{
  position:absolute;
  left:4px;
  top:4px;
  height:32px;
  border-radius:10px;
  background:var(--accentSoft);
  border:1px solid rgba(46,166,255,.20);
  z-index:1;
  transition:transform .2s cubic-bezier(.4,0,.2,1),width .2s cubic-bezier(.4,0,.2,1);
  box-shadow:0 2px 8px rgba(46,166,255,.15);
}

/* ---------- help ---------- */
.help__title{font-weight:600;font-size:17px;margin-bottom:12px}
.help__list{margin:0;padding-left:20px}
.help__list li{margin:10px 0;line-height:1.5}

/* ---------- toast ---------- */
.toast{
  position:fixed;
  left:50%;
  bottom:20px;
  transform:translateX(-50%) translateY(10px);
  width:auto;
  max-width:min(420px, calc(100vw - 28px));
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.50);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  box-shadow:var(--shadowHard);
  padding:12px 16px;
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease,transform .2s ease;
  z-index:9999;
}
.toast.is-on{
  opacity:1;
  transform:translateX(-50%) translateY(0);
  pointer-events:auto;
}
.toast__inner{display:inline-flex;align-items:center;gap:10px}
.toast__icon{flex:0 0 auto;font-size:20px}
.toast__msg{
  flex:1 1 auto;
  min-width:0;
  overflow:visible;
  font-weight:600;
  white-space:normal;
  font-size:15px;
}

/* ---------- focus ---------- */
.tabs__btn,
.segmini__btn,
.btn,
.iconbtn{
  -webkit-tap-highlight-color:transparent;
}
.tabs__btn:focus,
.segmini__btn:focus,
.btn:focus,
.iconbtn:focus{outline:none}
.tabs__btn:focus-visible,
.segmini__btn:focus-visible,
.btn:focus-visible,
.iconbtn:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

/* ---------- light theme tweaks ---------- */
html[data-theme="light"] body{
  background:
    radial-gradient(900px 500px at 50% -120px, rgba(0,122,255,.10), transparent 55%),
    radial-gradient(900px 600px at 80% 110%, rgba(0,122,255,.06), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

html[data-theme="light"] .tabs{
  background:rgba(255,255,255,.75);
  backdrop-filter:blur(20px);
}
html[data-theme="light"] .tabs__indicator{
  border-color:rgba(0,0,0,.08);
  background:rgba(0,0,0,.05);
}
html[data-theme="light"] .tabs__btn{color:rgba(0,0,0,.52)}
html[data-theme="light"] .tabs__btn.is-active{color:rgba(0,0,0,.88)}

html[data-theme="light"] .btn{
  border-color:rgba(0,0,0,.10);
  background:rgba(255,255,255,.85);
  color:rgba(0,0,0,.88);
}
html[data-theme="light"] .btn--primary{
  background:rgba(0,122,255,.12);
  border-color:rgba(0,122,255,.20);
  color:var(--accent);
}
html[data-theme="light"] .input{
  background:rgba(255,255,255,.90);
  border-color:rgba(0,0,0,.12);
  color:rgba(0,0,0,.88);
}
html[data-theme="light"] .input::placeholder{color:rgba(0,0,0,.35)}
html[data-theme="light"] .segmini{
  background:rgba(255,255,255,.85);
  border-color:rgba(0,0,0,.10);
}
html[data-theme="light"] .segmini__btn{color:rgba(0,0,0,.52)}
html[data-theme="light"] .segmini__btn.is-active{color:rgba(0,0,0,.88)}
html[data-theme="light"] .segmini__indicator{
  border-color:rgba(0,122,255,.20);
  background:rgba(0,122,255,.12);
}
html[data-theme="light"] .recentitem{
  background:rgba(255,255,255,.85);
  border-color:rgba(0,0,0,.10);
}
html[data-theme="light"] .toast{
  background:rgba(255,255,255,.90);
  border-color:rgba(0,0,0,.10);
}
html[data-theme="light"] .profile-hero__bg{
  background:
    radial-gradient(circle at 30% 20%, rgba(0,122,255,.18), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(138,92,246,.12), transparent 50%),
    linear-gradient(135deg, rgba(0,122,255,.08) 0%, rgba(138,92,246,.06) 100%);
}

/* ========== MODAL (Settings) ========== */
body.modal-open{ overflow:hidden; }

.modal{
  position:fixed;
  inset:0;
  z-index:9000;
  display:none;
}
.modal.is-open{ display:block; }

.modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}

.modal__sheet{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(520px, calc(100vw - 28px));
  max-height:min(82vh, 720px);
  border-radius:22px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.035);
  box-shadow:var(--shadowHard);
  overflow:hidden;
  backdrop-filter:blur(22px);
  -webkit-backdrop-filter:blur(22px);
}

.modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 12px 10px;
  border-bottom:1px solid var(--line);
  background:rgba(255,255,255,.02);
}

.modal__title{
  font-size:17px;
  font-weight:700;
  letter-spacing:-.2px;
}

.modal__body{
  padding:12px;
  overflow:auto;
}

.modal__card{
  padding:14px;
}

.modal__links{
  margin-top:12px;
  border-radius:var(--radius);
  border:1px solid var(--line);
  background:var(--card);
  box-shadow:var(--shadow);
  overflow:hidden;
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
}

.modal__link{
  width:100%;
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 14px;
  background:transparent;
  border:none;
  color:var(--text);
  cursor:pointer;
  border-bottom:1px solid var(--line);
  transition:all .2s ease; /* сохраняем твою "живость" */
}
.modal__link:last-child{ border-bottom:none; }

.modal__link:hover{
  background:rgba(255,255,255,.05);
  transform:translateY(-1px);
}
.modal__link:active{ transform:translateY(0); }

.modal__linkIcon{
  width:38px;
  height:38px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  display:grid;
  place-items:center;
  font-size:18px;
  flex:0 0 auto;
}

.modal__linkText{
  flex:1 1 auto;
  text-align:left;
  font-size:15px;
  font-weight:600;
}

.modal__chev{
  color:var(--muted);
  font-size:22px;
  line-height:1;
}

/* Mobile bottom sheet */
@media (max-width: 520px){
  .modal__sheet{
    left:0;
    right:0;
    bottom:0;
    top:auto;
    transform:none;
    width:100%;
    max-height:86vh;
    border-bottom-left-radius:0;
    border-bottom-right-radius:0;
  }
}

/* Light theme: make modal look clean (not dirty-gray) */
html[data-theme="light"] .modal__backdrop{
  background:rgba(0,0,0,.28);
}

html[data-theme="light"] .modal__sheet{
  background:rgba(255,255,255,.82);
  border-color:rgba(0,0,0,.10);
  box-shadow:0 18px 55px rgba(0,0,0,.18);
}

html[data-theme="light"] .modal__head{
  background:rgba(255,255,255,.70);
  border-bottom-color:rgba(0,0,0,.10);
}

html[data-theme="light"] .modal__links{
  border-color:rgba(0,0,0,.10);
  background:rgba(255,255,255,.82);
}

html[data-theme="light"] .modal__link{
  border-bottom-color:rgba(0,0,0,.08);
}

html[data-theme="light"] .modal__link:hover{
  background:rgba(0,0,0,.04);
}

html[data-theme="light"] .modal__linkIcon{
  border-color:rgba(0,0,0,.10);
  background:rgba(0,0,0,.03);
}

/* =========================
   Mobile optimization
   append-only
   ========================= */

/* 1) Make app full-width on phones */
@media (max-width: 640px){
  .app{
    width: 100%;
    margin: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .header{
    padding: 10px 2px 10px;
  }

  .brand__icon{
    width: 34px;
    height: 34px;
    border-radius: 14px;
  }

  .header__actions .iconbtn{
    width: 42px;
    height: 42px;
    border-radius: 16px;
  }

  .tabs{
    border-radius: 18px;
    padding: 6px;
  }

  .h1{
    font-size: 22px;
    margin: 10px 2px 12px;
  }

  /* 2) Stack input+button vertically */
  .card__row{
    flex-direction: column;
    gap: 10px;
  }

  .input, .btn{
    width: 100%;
    height: 46px; /* better tap target */
    border-radius: 16px;
  }

  /* 3) Reduce card paddings slightly */
  .card__head{
    padding: 14px 14px 10px;
  }

  .result{
    padding: 10px 14px 0;
  }

  /* 4) Keep tool cards comfortable */
  .toolgrid{
    gap: 12px;
  }
}

/* 5) Better viewport behavior on iOS/Telegram */
@supports (height: 100dvh){
  body{
    min-height: 100dvh;
  }
}