/* Modern AI Analysis WebApp Design */
:root {
  --bg: #0a0d12;
  --card: #161a21;
  --card-hover: #1a1f27;
  --surface: #1f242d;
  --text: #f5f7fa;
  --text-secondary: #9ba3b0;
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-light: rgba(22, 163, 74, 0.1);
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px -2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px -4px rgba(0,0,0,0.5), 0 2px 8px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 32px -8px rgba(0,0,0,0.6), 0 6px 16px -4px rgba(0,0,0,0.4);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
body { margin: 0; background: linear-gradient(160deg, #06070c 0%, #10131c 45%, #07090f 100%); background-attachment: fixed; color: var(--text); min-height: 100vh; display: flex; justify-content: center; font-size: 15px; line-height: 1.6; position: relative; overflow-x: hidden; }
.bg-gradient { position: fixed; inset: 0; background: radial-gradient(120% 90% at 20% 10%, rgba(59,130,246,0.18) 0%, rgba(59,130,246,0) 55%), radial-gradient(90% 75% at 85% 15%, rgba(34,197,94,0.25) 0%, rgba(34,197,94,0) 60%); filter: blur(0); z-index: -2; }
body::before { content: ''; position: fixed; inset: 0; background: radial-gradient(65% 65% at 50% 20%, rgba(14,116,144,0.18) 0%, rgba(14,116,144,0) 60%); z-index: -3; pointer-events: none; }
main { width: 100%; max-width: 920px; padding: 20px 16px 80px; }
header { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
h1 { font-size: 1.75rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.subtitle { margin: 8px 0 0; font-size: 0.95rem; color: rgba(229,231,235,0.75); max-width: 480px; }
.card { background: var(--card); border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius-lg); padding: 32px 28px; box-shadow: var(--shadow-lg); position: relative; overflow: visible; transition: border-color var(--transition); backdrop-filter: blur(18px); background-clip: padding-box; }
.card:hover { border-color: rgba(255,255,255,0.08); }
.card.dragover { border-color: var(--accent); background: rgba(22, 163, 74, 0.03); }
.sport-selector { max-width: 460px; margin: 0 auto 28px; position: relative; }
.sport-selector summary { list-style:none; }
.sport-selector summary::-webkit-details-marker { display:none; }
.sport-trigger { width: 100%; background: linear-gradient(135deg, var(--surface) 0%, #1a1f28 100%); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius); padding: 14px 18px; display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 0.95rem; font-weight: 600; color: var(--text); transition: all var(--transition); box-shadow: var(--shadow-sm); user-select:none; }
.sport-trigger:hover { background: linear-gradient(135deg, #242932 0%, #1f242d 100%); border-color: rgba(255,255,255,0.12); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.sport-trigger:active { transform: translateY(0); }
.sport-selector[open] .sport-trigger { background: var(--card-hover); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-md); }
.sport-icon { flex-shrink: 0; color: var(--accent); opacity: 0.8; }
.sport-trigger span { flex: 1; text-align: left; }
.chevron { flex-shrink: 0; color: var(--text-secondary); transition: transform var(--transition); }
.sport-selector[open] .chevron { transform: rotate(180deg); }
.sport-menu { position: relative; top: 0; left: 0; right: 0; background: var(--card); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow-md); max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.3s ease, opacity 0.25s ease; margin-top: 8px; }
.sport-selector[open] .sport-menu { max-height: 420px; opacity: 1; overflow-y: auto; }
/* Portal (body-level) variant */
#sport-menu-portal.sport-menu { position:absolute; left:0; top:0; right:auto; width:var(--portal-width, 340px); max-height:0; opacity:0; overflow:hidden; pointer-events:none; }
#sport-menu-portal.sport-menu.open { max-height:420px; opacity:1; overflow:auto; pointer-events:auto; }
.sport-menu::-webkit-scrollbar { width: 6px; }
.sport-menu::-webkit-scrollbar-track { background: transparent; }
.sport-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.sport-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
.sport-option { position: relative; display: flex; align-items: center; padding: 0; margin: 2px 0; cursor: pointer; border-radius: var(--radius-sm); transition: background var(--transition); }
.sport-option:hover { background: rgba(255,255,255,0.04); }
.sport-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.sport-option span { flex: 1; padding: 11px 14px; font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); transition: color var(--transition); }
.sport-option:hover span { color: var(--text); }
.sport-option input:checked + span { color: var(--accent); font-weight: 600; position: relative; }
.sport-option input:checked + span::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 60%; background: var(--accent); border-radius: 2px; }
.placeholder { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 48px 20px; background: rgba(255,255,255,0.02); border: 2px dashed rgba(255,255,255,0.1); border-radius: var(--radius); transition: all var(--transition); cursor: pointer; }
.placeholder:hover { border-color: var(--accent); background: var(--accent-light); }
.placeholder svg { width: 56px; height: 56px; stroke: var(--accent); opacity: 0.8; }
.placeholder strong { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.muted { color: var(--text-secondary); font-size: 0.875rem; }
.actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
button.primary { background: linear-gradient(135deg, var(--accent) 0%, #15803d 100%); color: #fff; border: none; padding: 15px 24px; border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 1rem; flex: 1; min-width: 200px; display: flex; justify-content: center; align-items: center; gap: 8px; transition: all var(--transition); box-shadow: 0 4px 16px -4px rgba(22, 163, 74, 0.5); }
button.primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--accent-hover) 0%, #166534 100%); box-shadow: 0 6px 20px -4px rgba(22, 163, 74, 0.6); transform: translateY(-2px); }
button.primary:active:not(:disabled) { transform: translateY(0); }
button.primary:disabled { opacity: 0.4; cursor: not-allowed; }
button.secondary { background: var(--surface); border: 1px solid rgba(255,255,255,0.08); color: var(--text); padding: 12px 20px; border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 0.95rem; transition: all var(--transition); }
button.secondary:hover { background: var(--card-hover); border-color: rgba(255,255,255,0.12); transform: translateY(-1px); }
.progress-steps { display: flex; gap: 12px; margin: 24px 0 16px; }
.progress-steps .step { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; position: relative; overflow: hidden; }
.progress-steps .step.active::after { content: ''; position: absolute; inset: 0; background: var(--accent); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.6; } to { opacity: 1; } }
.results-section { margin-bottom: 28px; }
.results-section .section-header { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.results-section .section-header h2 { margin: 0; font-size: 1.05rem; font-weight: 700; color: #e2e8f0; letter-spacing: -0.01em; }
.results-section .section-header p { margin: 0; font-size: 0.85rem; color: rgba(148,163,184,0.85); }
.results-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: stretch; }
.primary-grid { margin-top: 4px; }
.secondary-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.results-section.secondary { margin-top: 32px; }
.block.highlight { text-align: center; background: radial-gradient(circle at top, rgba(34,197,94,0.18) 0%, rgba(34,197,94,0.05) 55%, rgba(22,163,74,0.02) 90%); border: 1px solid rgba(34,197,94,0.28); box-shadow: 0 18px 40px -15px rgba(34,197,94,0.5); }
.confidence-circle { width: 140px; height: 140px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 20px auto; background: linear-gradient(135deg, rgba(22,163,74,0.25), rgba(14,116,144,0.25)); border: 2px solid rgba(255,255,255,0.12); box-shadow: inset 0 0 30px rgba(22,163,74,0.2); }
.confidence-circle span { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.03em; color: #f8fafc; }
.block.primary .signal-main { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
#reason-text { font-size: 0.9rem; line-height: 1.5; color: rgba(226,232,240,0.82); }
.block.wide { grid-column: 1 / -1; }
.draw-content { font-size: 0.9rem; line-height: 1.5; }
.totals-list { display: flex; flex-direction: column; gap: 12px; }
.totals-item { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.totals-item .market { font-weight: 600; color: #f1f5f9; }
.totals-item .match { font-size: 0.85rem; color: rgba(226,232,240,0.75); }
.totals-item .meta { text-align: right; font-size: 0.85rem; color: rgba(148,163,184,0.9); }
.totals-item strong { color: #4ade80; }
.hidden-block { display: none !important; }
.block { background: var(--surface); border: 1px solid rgba(255,255,255,0.06); padding: 20px 18px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 12px; min-height: 150px; transition: border-color var(--transition); }
.block:hover { border-color: rgba(255,255,255,0.1); }
.block h3 { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); }
.signal-text { font-size: 1.25rem; font-weight: 600; line-height: 1.35; color: #f1f5f9; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(56,189,248,0.16); border: 1px solid rgba(125,211,252,0.35); color: #bae6fd; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; border-radius: 999px; padding: 4px 10px; }
.prob-list { display: flex; flex-direction: column; gap: 12px; }
.prob-row { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "label label" "bar value"; align-items: center; gap: 7px 12px; }
.prob-row .label { grid-area: label; min-width: 0; font-size: 0.85rem; font-weight: 600; line-height: 1.35; color: rgba(226,232,240,0.88); overflow-wrap: anywhere; }
.bar { grid-area: bar; width: 100%; height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; position: relative; overflow: hidden; }
.bar span { position: absolute; inset: 0; background: linear-gradient(90deg, var(--accent), #22c55e); width: 0; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.prob-row .val { grid-area: value; font-size: 0.85rem; font-weight: 700; color: var(--accent); min-width: 42px; text-align: right; }
.explanation { font-size: 0.9rem; line-height: 1.6; white-space: pre-line; color: var(--text-secondary); }
.muted-small { font-size: 0.78rem; color: rgba(148,163,184,0.9); }
.footer-note { margin-top: 48px; text-align: center; font-size: 0.7rem; letter-spacing: 0.05em; color: rgba(255,255,255,0.25); font-weight: 500; }
.limit-line { margin-top: 16px; font-size: 0.8rem; color: var(--text-secondary); text-align: center; }
.lang-switch { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.lang-switch button { width: auto; min-width: 46px; padding: 7px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: var(--text-secondary); cursor: pointer; }
.lang-switch button.active { border-color: var(--accent); background: var(--accent-light); color: var(--text); }
.error { color: var(--danger); font-weight: 600; font-size: 0.95rem; padding: 14px 18px; background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.2); border-radius: var(--radius); margin-bottom: 20px; }
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.loading-dots { display: inline-flex; gap: 4px; }
.loading-dots span { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; animation: bounce 0.8s infinite alternate; }
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { from { transform: scale(0.6); opacity: 0.5; } to { transform: scale(1); opacity: 1; } }
input[type="file"] { display: none; }
.dropzone-preview img { max-width: 100%; border-radius: var(--radius); margin-top: 16px; box-shadow: var(--shadow-md); border: 1px solid rgba(255,255,255,0.06); }
@media (max-width: 640px) {
  main { padding: 16px 12px 60px; }
  .card { padding: 24px 20px; }
  h1 { font-size: 1.5rem; }
  .results-grid { grid-template-columns: 1fr; }
  .sport-selector { margin-bottom: 24px; }
  .prob-row { gap: 7px 10px; }
}

/* Fallback: принудительно раскрытое меню (если Telegram WebView блокирует события) */
.sport-selector.fallback .sport-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  max-height: 420px !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
  overflow-y: auto !important;
  pointer-events: auto !important;
}
.sport-selector.fallback .sport-trigger { border-color: var(--accent); }
.sport-selector.fallback .chevron { opacity: .6; }

/* Для no-js */
/* Убрали no-js автооткрытие: теперь JS гарантированно сам управляет */

/* Grox: charcoal surfaces and the magenta-to-red identity from BR1Copy. */
:root { --bg:#101010; --card:#181818; --card-hover:#222; --surface:#222; --text:#faf7fa; --text-secondary:#aaa3aa; --accent:#f32996; --accent-hover:#d71978; --accent-light:rgba(243,41,150,.09); --radius:14px; --radius-lg:24px; }
body { background:#101010; }
.bg-gradient { background:radial-gradient(ellipse at 85% 0%,rgba(233,0,155,.12),transparent 52%); }
body::before { display:none; }
main { max-width:820px; padding:40px 24px 48px; }
.brand-header { gap:16px; margin-bottom:30px; }
.brand-line { display:flex; align-items:center; gap:16px; width:100%; }
.brand-mark { width:66px; height:66px; flex-shrink:0; }
.brand-mark img { display:block; width:100%; height:100%; object-fit:contain; filter:drop-shadow(0 6px 18px rgba(240,12,133,.18)); }
.eyebrow { margin:0 0 4px; color:#a8a0a6; font-size:9px; letter-spacing:.17em; font-weight:650; }
h1 { font-size:34px; line-height:1.1; letter-spacing:-.045em; color:#fff; background:none; -webkit-text-fill-color:initial; }
.subtitle { font-size:19px; color:#d2cbd1; margin:0; letter-spacing:-.025em; }
.locale-badge { margin-left:auto; color:#d0c7ce; font-size:10px; font-weight:700; letter-spacing:.08em; padding:5px 9px; border:1px solid #383036; border-radius:8px; }
.card { background:#181818; box-shadow:0 12px 42px rgba(0,0,0,.2); border-color:#2b262a; padding:26px; backdrop-filter:none; }
.sport-selector { max-width:none; margin-bottom:18px; }
.sport-trigger { background:#202020; box-shadow:none; border-color:#332d32; font-size:14px; padding:13px 16px; }
.sport-trigger:hover { background:#292329; border-color:#57424f; box-shadow:none; transform:none; }
.placeholder { background:linear-gradient(145deg,rgba(243,41,150,.055),rgba(255,33,67,.02)); border:1px dashed #6c3b56; min-height:235px; padding:36px 20px; gap:14px; }
.placeholder strong { font-size:19px; font-weight:600; letter-spacing:-.025em; }
.placeholder svg { width:42px; height:42px; opacity:1; }
.muted { color:#b1a7af; }
#paste-hint { font-size:12px; }
#limit-hint { font-size:11px; text-align:center; margin-top:13px; color:#958c93; }
.actions { margin-top:20px; }
button.primary { background:linear-gradient(110deg,#e30fbb,#fb1752); box-shadow:0 7px 24px rgba(227,15,154,.17); color:#fff; border-radius:14px; font-size:15px; }
button.primary:hover:not(:disabled) { background:linear-gradient(110deg,#f524ca,#ff3265); box-shadow:0 8px 26px rgba(227,15,154,.28); transform:translateY(-1px); }
button.primary:disabled { background:#33262e; color:#99808e; opacity:1; box-shadow:none; }
button.secondary { background:#262126; border-color:#42343d; font-size:13px; }
.limit-line { font-size:11px; color:#a89aa4; text-align:center; }
.footer-note { text-align:center; margin:27px auto 0; color:#a3949f; font-size:11px; line-height:1.9; }
.footer-note span { color:#80747c; font-size:10px; }
.block.highlight { background:linear-gradient(150deg,rgba(240,25,144,.12),rgba(246,22,71,.025)); border-color:rgba(243,41,150,.23); box-shadow:none; }
.confidence-circle { background:rgba(243,41,150,.06); border-color:rgba(243,41,150,.3); box-shadow:inset 0 0 25px rgba(243,41,150,.08); }
.bar span { background:linear-gradient(90deg,#e20bbc,#ff2452); }
.totals-item strong { color:#fa82ba; }
.results-section .section-header h2 { color:#fff; }
.badge { color:#fa9bc9; border-color:#6b3452; background:#3a1b2d; }
button:focus-visible, summary:focus-visible, label:focus-within { outline:2px solid #fa82ba; outline-offset:4px; }
@media(max-width:640px){ main{padding:24px 16px 34px;} .card{padding:18px;} .brand-mark{width:56px;height:56px;} h1{font-size:30px;} .subtitle{font-size:18px;} .placeholder{min-height:218px;padding:28px 15px;} .placeholder strong{font-size:17px;} .eyebrow{font-size:8px;} .results-grid,.secondary-grid{grid-template-columns:minmax(0,1fr);} }
@media(prefers-reduced-motion:reduce){ *,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important;} }
