.lucky-web #performance-share-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.lucky-web #performance-share-open svg {
  width: 1em;
  height: 1em;
  flex: none;
}

#performance-share-dialog {
  width: min(460px, calc(100vw - 24px));
}

#performance-share-image {
  display: block;
  width: 100%;
  max-height: 65dvh;
  object-fit: contain;
  border-radius: 10px;
}

.performance-share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

#performance-share-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  font-weight: 650;
  text-decoration: none;
}

.lucky-web #web-settings-note {
  margin: 8px 0 12px;
}

.lucky-web[data-web-session="setup"] #mode-note {
  color: var(--warn);
}

@media (min-width: 900px) {
  .lucky-web #dashboard .metrics article {
    min-height: 132px;
  }

  .lucky-web[data-web-session]:not([data-web-session="account"]) .source-pnl {
    min-height: 43px;
  }
}

@media (max-width: 680px) {
  .lucky-web {
    --phone-gutter: max(12px, env(safe-area-inset-left), env(safe-area-inset-right));
    font-size: 14px;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
  }

  .lucky-web .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    min-height: 50px;
    gap: 5px;
    padding: max(7px, env(safe-area-inset-top)) var(--phone-gutter) 7px;
  }
  .lucky-web .brand { min-width: 0; gap: 7px; }
  .lucky-web .brand-icon { width: 28px; height: 28px; border-radius: 7px; }
  .lucky-web .brand-copy { min-width: 0; }
  .lucky-web .brand h1 { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 1.2; }
  .lucky-web .brand h1 > span { display: none; }
  .lucky-web .live-title-status { padding: 1px 4px; font-size: 9px; }
  .lucky-web .header-actions { margin: 0; gap: 3px; }
  .lucky-web :is(.header-actions > button,#language) {
    min-height: 34px;
    min-width: 0;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.15;
  }
  .lucky-web:not([data-web-session="account"]) :is(#mode-toggle,.live-title-status) { display: none; }
  .lucky-web #phone-menu summary { width: 34px; height: 34px; }
  .lucky-web #phone-menu-actions { min-width: 158px; }
  .lucky-web #phone-menu-actions :is(a,button) {
    display: flex; align-items: center; width: 100%; min-height: 36px;
    padding: 4px 7px; font-size: 12px; font-weight: 580; animation: none;
  }
  .lucky-web #phone-menu-actions :is(a,button):hover { background: #35302d; }
  .lucky-web #phone-menu-actions #account-label { padding: 4px 7px; }

  .lucky-web #workspace { padding-inline: var(--phone-gutter); }
  .lucky-web .workspace-nav {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--bg);
  }
  .lucky-web .workspace-nav > .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1.6fr 1fr;
    justify-items: stretch;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    overflow: visible;
    margin-top: 3px;
  }
  .lucky-web .workspace-nav .tabs button {
    min-width: 0;
    min-height: 38px;
    padding: 5px 2px;
    white-space: normal;
    line-height: 1.22;
    font-size: clamp(11px, 3vw, 13px);
  }
  .lucky-web .workspace-nav .tabs button.active { background: transparent; }
  .lucky-web .workspace-nav .tabs button.active::after { left: 17%; right: 17%; }
  .lucky-web .workspace-nav .count { font-size: 10px; margin-left: 0; padding-inline: 4px; }
  .lucky-web .workspace-announcement { margin: 2px 0 5px; padding: 6px 0; }
  .lucky-web .status-line { min-height: 24px; gap: 2px 7px; font-size: 11px; }
  .lucky-web #notice { font-size: 12px; }

  .lucky-web #dashboard .hero {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 5px 6px;
    margin-top: 3px;
    padding: 3px 0 2px;
    border: 0;
    border-radius: 0;
    background: none;
  }
  .lucky-web .hero > div:first-child { display: contents; }
  .lucky-web .hero h2 { grid-column: 1; grid-row: 1; font-size: 17px; letter-spacing: 0; }
  .lucky-web .hero p { grid-column: 1 / -1; grid-row: 2; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
  .lucky-web .hero-actions { grid-column: 2; grid-row: 1; justify-content: flex-end; gap: 4px; }
  .lucky-web .hero-actions button { min-height: 34px; padding: 4px 6px; font-size: 11px; }
  .lucky-web #sync { color: #ffb17f; background: #35251d; border-color: #634029; }
  :lang(en) .lucky-web .sync-label-desktop { display: none; }
  :lang(en) .lucky-web .sync-label-phone { display: inline; }

  .lucky-web .metrics {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 0;
    margin-block: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }
  .lucky-web:not([data-web-session="account"]) .metrics { display: none; }
  .lucky-web .metrics article { padding: 8px 9px 7px; gap: 2px; border: 0; border-radius: 0; background: none; }
  .lucky-web .metrics article:nth-child(2n) { border-left: 1px solid var(--line); }
  .lucky-web .metrics article:nth-child(n+3) { border-top: 1px solid var(--line); }
  .lucky-web .metrics strong { font-size: clamp(16px,4.35vw,20px); line-height: 1.42; }
  .lucky-web .metrics :is(span,.sub) { font-size: 11px; }
  .lucky-web .metric-help { min-width: 23px; min-height: 23px; }
  .lucky-web .pnl-mood img { width: 29px; height: 29px; }
  .lucky-web #holdings-toggle {
    display: block; justify-self: start; min-height: 25px; padding: 2px 5px;
    color: #ffb17f; background: transparent; font-size: 10px;
  }
  .lucky-web #holdings-toggle[aria-expanded="false"] + #holdings-channels { display: none; }

  .lucky-web .source-cards[data-count] { grid-template-columns: minmax(0,1fr); gap: 5px; }
  .lucky-web .source-summary { min-height: 58px; padding: 5px 8px; gap: 7px; }
  .lucky-web .source-summary-name strong { overflow-wrap: anywhere; }
  .lucky-web .source-summary-row > .source-telegram .source-join-hint { display: none; }
  .lucky-web .source-stats { padding: 7px; }
  .lucky-web .section-title { margin-bottom: 5px; gap: 5px; }
  .lucky-web .section-title h3 { font-size: 14px; }
  .lucky-web .source-section-heading { align-items: center; gap: 3px 6px; }
  .lucky-web #source-channel-hint { display: none; }
  .lucky-web :is(#source-apply-open,#feed-log-open) { min-height: 30px; padding: 3px 6px; font-size: 10.5px; }
  .lucky-web .source-pnl-breakdown { margin-bottom: 7px; padding: 5px 8px; font-size: 10px; }
  .lucky-web:not([data-web-session="account"]) .source-pnl-breakdown { display: none; }

  .lucky-web :is(#signals,#positions,#settings) { padding: 12px; }
  .lucky-web .panel-heading button { min-height: 35px; }
  .lucky-web input:not([type="checkbox"],[type="range"]), .lucky-web :is(select,textarea) {
    font-size: 16px;
    min-height: 40px;
  }
  .lucky-web .activity-filters, .lucky-web #signals .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  .lucky-web .activity-filter { display: grid; min-width: 0; }
  .lucky-web :is(#signals .actions input[type="search"],#signals .actions label) { grid-column: 1 / -1; }
  .lucky-web #signals .actions :is(input,select) { width: 100%; min-width: 0; }

  .lucky-web :is(#signals,#positions) .table-wrap { border: 0; overflow: visible; }
  .lucky-web :is(#signals,#positions) :is(table,tbody) { display: block; width: 100%; min-width: 0; }
  .lucky-web :is(#signals,#positions) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
  }
  .lucky-web :is(#signals,#positions) tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    align-items: start;
    gap: 9px 12px;
    padding: 11px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #1d1d1d;
  }
  .lucky-web :is(#signals,#positions) tbody tr:last-child { margin-bottom: 0; }
  .lucky-web :is(#signals,#positions) tbody tr.focused { border-color: #a2603c; background: #35251d; }
  .lucky-web :is(#signals,#positions) td {
    padding: 0;
    border: 0;
    min-width: 0;
    max-width: none;
    font-variant-numeric: tabular-nums;
  }
  .lucky-web :is(#signals,#positions) td:is(:first-child,:last-child,.empty) { grid-column: 1 / -1; }
  .lucky-web :is(#signals,#positions) td:first-child:not(.empty) {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    font-weight: 650;
  }
  .lucky-web :is(#signals,#positions) td[data-label]:not(:first-child,:last-child)::before {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 2px;
    content: attr(data-label);
  }
  .lucky-web :is(#signals,#positions) .row-actions { gap: 6px; }
  .lucky-web :is(#signals,#positions) .row-actions :is(button,.market-link) {
    min-height: 36px;
    padding: 4px 8px;
    font-size: 12px;
  }
  .lucky-web #positions td:nth-child(5) > span { font-size: 15px; font-weight: 650; }
  .lucky-web .pagination { justify-content: space-between; flex-wrap: wrap; }
  .lucky-web .pagination button { min-height: 36px; }
  .lucky-web .pagination:not(:has(>button:not(:disabled))) { justify-content: center; }
  .lucky-web .pagination:not(:has(>button:not(:disabled))) > button { display: none; }

  .lucky-web .settings-columns > * { min-width: 0; }
  .lucky-web .settings-aux { border-top: 1px solid var(--line); padding-top: 8px; }
  .lucky-web #settings :is(fieldset,input,select) { min-width: 0; max-width: 100%; }
  .lucky-web #settings :is(.settings-grid,.rule-inputs) > label { min-width: 0; }
  .lucky-web #settings .rule-inputs { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .lucky-web .profile-card { min-width: 0; padding: 12px; }
  .lucky-web :is(#profile,#settings) button { min-height: 40px; }
  .lucky-web #profile .profile-nav button { min-height: 36px; padding: 6px 5px; font-size: 12px; }
  .lucky-web #profile #profile-nav-telegram { white-space: nowrap; }
  .lucky-web dialog {
    max-width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }
  .lucky-web footer {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 10px;
    padding-inline: var(--phone-gutter);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}


@media (max-width: 520px) {
  .lucky-web #dashboard .hero:has(#performance-share-open:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .lucky-web .hero:has(#performance-share-open:not([hidden])) .hero-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-start;
    gap: 5px;
    margin-top: 3px;
  }
}

@media (max-width: 360px) {
  .lucky-web .app-header { gap: 4px; }
  .lucky-web :is(.header-actions > button,#language) { padding-inline: 5px; font-size: 11px; }
  .lucky-web #phone-menu summary { width: 31px; }
  .lucky-web .hero h2 { font-size: 16px; }
  .lucky-web .hero-actions button { padding-inline: 4px; }
  .lucky-web .sync-label-desktop { display: none; }
  .lucky-web .sync-label-phone { display: inline; }
}

.lucky-web .match-live-link {
  color: #ffc19d;
  background: #35251d;
  border-color: #70452d;
}
.lucky-web .match-start-countdown,
.lucky-web .match-start-countdown:hover {
  min-inline-size: 3.5em;
  justify-content: center;
  color: var(--muted);
  background: var(--surface2);
  border-color: var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lucky-web .match-live-link::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-inline-end: 5px;
  border-radius: 50%;
  background: #ff8951;
}
