/* Shared visual foundation; preserve established desktop card dimensions. */
:root{--focus-ring:0 0 0 3px #82b2ff40;--surface-raised:#142136}
body{background-color:var(--bg-main);text-rendering:optimizeLegibility}
button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--primary-blue);outline-offset:3px}
.btn{transition:background .16s,border-color .16s,box-shadow .16s}.btn:hover:not(:disabled){box-shadow:0 4px 18px #6d9ee526}.btn:disabled{cursor:not-allowed}
.inp:focus{border-color:var(--primary-blue);box-shadow:var(--focus-ring)}
.book-logo{width:28px;height:28px;object-fit:contain;display:inline-block;vertical-align:middle;margin-right:9px;border-radius:5px;flex-shrink:0}.book-monogram{display:inline-grid;place-items:center;width:26px;height:26px;border:1px solid var(--border-color);border-radius:6px;margin-right:8px}
.tool-shell{width:min(1440px,calc(100% - 64px));margin:auto}.tool-head{display:flex;justify-content:space-between;gap:24px;align-items:center;margin:32px 0 26px}.tool-head h1{font-size:clamp(28px,3vw,38px);letter-spacing:-1.1px;line-height:1.1;margin:10px 0 14px}.tool-head p{color:var(--text-secondary);max-width:660px;line-height:1.8}.tool-art{width:100px;height:100px;object-fit:contain}
.tool-panel{background:var(--bg-card);border:1px solid var(--border-color);border-radius:18px;padding:26px;margin-bottom:20px}.tool-panel h2{font-size:20px;margin:0 0 16px}.tool-toolbar{display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin-bottom:20px}.tool-toolbar label,.profile-grid label{display:grid;gap:8px;color:var(--text-secondary);font-size:12px;flex:1;min-width:140px}.tool-toolbar .inp{margin:0}.tool-message{color:var(--text-secondary);font-size:13px;line-height:1.7;padding:16px 0}.tool-message[data-error=true]{color:var(--accent-red)}
.history-list{display:grid;gap:10px}.history-match{text-align:left;width:100%;background:var(--bg-input);border:1px solid var(--border-color);border-radius:12px;color:var(--text-primary);padding:18px;display:flex;justify-content:space-between;gap:14px;cursor:pointer}.history-match:hover{border-color:var(--primary-blue)}.history-match strong,.history-match small{display:block}.history-match small{color:var(--text-secondary);margin-top:7px}.history-chart{width:100%;height:230px;display:block;overflow:visible}.history-chart text{fill:var(--text-secondary);font:11px 'DM Sans',sans-serif}.history-chart .grid{stroke:var(--border-color)}.history-chart polyline{fill:none;stroke:#89b6ff;stroke-width:2.5}.history-table{width:100%;border-collapse:collapse;font-size:12px}.history-table td,.history-table th{text-align:left;padding:12px;border-bottom:1px solid var(--border-color)}.history-table th{color:var(--text-secondary);font-weight:500}.history-drawer{background:var(--bg-main);color:var(--text-primary);border:1px solid var(--border-color);border-radius:16px;width:min(1000px,95vw);height:90vh;padding:15px}.history-drawer::backdrop{background:#030811ba;backdrop-filter:blur(5px)}.history-drawer form{text-align:right}.history-drawer iframe{border:0;width:100%;height:calc(100% - 55px)}
.profile-layout{display:grid;grid-template-columns:1fr 1.3fr;gap:24px}.profile-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.profile-grid .wide{grid-column:1/-1}.profile-grid .inp{margin:0}.profile-entry{border-bottom:1px solid var(--border-color);padding:17px 0}.profile-entry strong{display:block;margin-bottom:8px}.profile-entry small{color:var(--text-secondary)}.profile-entry button{margin:12px 6px 0 0}.profile-picker{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:12px 0}.profile-picker select{font:inherit;max-width:210px;padding:8px;background:var(--bg-input);color:var(--text-primary);border:1px solid var(--border-color);border-radius:8px}.profile-notice{font-size:11px;color:var(--text-secondary)}
.checkout-card .payment-qr{width:220px;height:220px;border-radius:12px;padding:8px}.qr-stage{background:#091321;border:1px solid #324966;border-radius:16px;margin:24px 0;padding:16px;text-align:center}.qr-stage p{font-size:12px;color:var(--text-secondary)}.premium-art{width:100%;height:160px;object-fit:cover;border-radius:12px;margin:20px 0}.billing-help{margin-bottom:32px}
@media(max-width:700px){.tool-shell{width:calc(100% - 32px)}.tool-head{margin-top:28px;gap:12px}.tool-art{width:64px;height:64px}.profile-layout{grid-template-columns:1fr}.tool-panel{padding:18px}.profile-grid{grid-template-columns:1fr}.history-match{flex-direction:column}.history-table-wrap{overflow:auto}.tool-toolbar label{min-width:120px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}



.opp-book .book-logo{width:54px;height:24px;margin-right:2px;border-radius:0}.premium-art{height:200px;object-position:center 45%}.app-header{position:relative;z-index:10}.tool-shell{max-width:1220px}.profile-picker .text-button{font-size:11px;color:var(--text-secondary);background:transparent;border:0;padding:6px 0;cursor:pointer}.profile-picker .text-button:hover{color:var(--primary-blue)}

.profile-calculator-dialog{width:min(760px,calc(100vw - 32px));max-height:90dvh;overflow:auto;border:1px solid #395373;border-radius:22px;padding:32px;background:linear-gradient(145deg,#152337,#0c1522);color:var(--text-primary);box-shadow:0 30px 100px #0008}.profile-calculator-dialog::backdrop{background:#030811b8;backdrop-filter:blur(6px)}.profile-calc-heading{display:flex;justify-content:space-between;align-items:center}.profile-calc-heading h2{font-size:28px;margin:8px 0}.profile-calc-intro{color:var(--text-secondary);font-size:13px;line-height:1.8;margin:12px 0 24px}.profile-calculator-dialog .btn{margin-top:20px}.profile-calc-allocations{display:grid;grid-template-columns:1fr 1fr;gap:16px}.profile-calc-allocations article{background:#0b1625;border:1px solid #344b69;border-radius:12px;padding:20px;display:grid;gap:8px}.profile-calc-allocations strong{font-size:26px}.profile-calc-allocations small,.profile-calc-allocations span{color:var(--text-secondary)}.profile-calculator-entry{position:relative;width:100%;text-align:left;padding:16px 42px 16px 16px;border:1px solid var(--border-color);border-radius:12px;background:var(--bg-input);color:var(--text-primary);font:inherit;cursor:pointer}.profile-calculator-entry small{display:block;margin-top:6px;color:var(--text-secondary);font-size:11px}.profile-calculator-entry b{position:absolute;right:18px;top:24px;color:var(--primary-blue)}

.profile-layout{align-items:start}.profile-entry{margin-top:14px;padding:20px;border:1px solid var(--border-color);border-radius:13px;background:var(--bg-input)}.profile-entry strong{font-size:16px}.profile-entry .btn{padding:9px 12px;font-size:12px}.profile-entry [data-remove]{color:var(--text-secondary);background:transparent}.tool-panel{box-shadow:inset 0 1px 0 #ffffff04}.tool-message:empty{display:none}.profile-grid h3{border-top:1px solid var(--border-color);padding-top:24px;margin:8px 0 0;font-size:15px}.profile-grid textarea{min-height:90px;resize:vertical}.history-list+.tool-toolbar{margin-top:20px;margin-bottom:0}.history-table caption{text-align:left;color:var(--text-secondary);padding:16px 12px}.tool-panel[hidden]{display:none}.profile-grid .btn,.tool-toolbar .btn{min-height:44px}
.tool-head>.tool-art{position:static;transform:none;inset:auto;width:100px;height:100px;flex-shrink:0;opacity:1}.tool-toolbar .btn,.profile-entry .btn,#profile-new{width:auto;margin-bottom:0}.tool-toolbar label{min-width:0}.tool-toolbar select{width:100%;min-width:0}.tool-toolbar .btn{flex-shrink:0}.profile-entry .btn{margin-bottom:0}.history-match[aria-pressed=true]{border-color:var(--primary-blue);background:#15263b}
.profile-library-link{display:flex;justify-content:space-between;align-items:center;margin-top:16px;text-decoration:none}.profile-library-link strong{font-size:13px}.profile-library-link small{display:block;font-size:11px;color:var(--text-secondary);margin-top:5px}.opp-book .profile-picker{padding-top:12px;border-top:1px solid var(--border-color)}
.book-top .book-letter:has(img){width:65px;background:transparent;border-color:transparent}.book-top .book-logo{width:60px;height:32px;margin:0;border-radius:0}
@media(max-width:700px){.profile-calculator-dialog{padding:22px}.profile-calc-allocations{grid-template-columns:1fr}.history-chart text{font-size:14px}.tool-head h1{letter-spacing:-1px}.profile-entry{padding:16px}.tool-toolbar{align-items:stretch}.tool-toolbar .btn{flex:1}.tool-toolbar select{max-width:100%}}


/* Restrained card details: wide, fading contours on feature cards only.
   Operational panels remain clean. Artwork never sits over text or controls. */
:where(.tool-card, .capabilities-grid article) {
  position: relative;
  isolation: isolate;
  --card-detail: url('assets/card-details/corner.svg');
}
:is(.tool-card, .capabilities-grid article)::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: var(--card-detail) center / 100% 100% no-repeat;
}
.capabilities-grid article:nth-child(3n + 1) {
  --card-detail: url('assets/card-details/sweep.svg');
}
.workspace-tools > .tool-card:nth-child(2),
.capabilities-grid article:nth-child(3n + 2) {
  --card-detail: url('assets/card-details/contour.svg');
}
.workspace-tools > .tool-card:nth-child(1) { --card-detail: url('assets/card-details/calculator-flow.svg'); }
.workspace-tools > .tool-card:nth-child(3) { --card-detail: url('assets/card-details/bet-flow.svg'); }
@media (max-width: 700px) {
  :is(.tool-card, .capabilities-grid article)::after { opacity: .55; }
}

/* At a glance: the original subtle arc, mirrored in opposite corners. */
.grid > .stat.premium-card { position: relative; isolation: isolate; }
.grid > .stat.premium-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 0 0,
      transparent 0 34%, #7ea9e829 34.2% 34.5%,
      #7ea9e809 34.7% 48%, #7ea9e811 48.2% 48.4%, transparent 48.6%) left top / 150px 150px no-repeat,
    radial-gradient(circle at 100% 100%,
      transparent 0 34%, #7ea9e829 34.2% 34.5%,
      #7ea9e809 34.7% 48%, #7ea9e811 48.2% 48.4%, transparent 48.6%) right bottom / 150px 150px no-repeat;
}
@media (max-width: 700px) {
  .grid > .stat.premium-card::after { background-size: 110px 110px; }
}

/* History keeps the match list beside the chart when there is space. */
.tool-shell{container-type:inline-size}
.tool-shell>.app-header{min-height:84px}
.tool-head>div{min-width:0}.tool-head p{font-size:14px;line-height:1.7}
.tool-head>.tool-art{width:86px;height:86px}
.history-welcome{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-height:470px;padding:42px;background:radial-gradient(ellipse at 100% 0,#75acff0b,transparent 70%),var(--bg-card)}
.history-welcome>img{margin-bottom:28px}.history-welcome .eyebrow{font-size:10px;letter-spacing:1.6px;color:var(--primary-blue);margin-bottom:12px}
.history-welcome h2{font-size:28px;letter-spacing:-.7px;margin:0 0 14px}
.history-welcome>p:not(.eyebrow){font-size:14px;line-height:1.8;color:var(--text-secondary);max-width:380px}
.history-welcome>div{display:flex;flex-wrap:wrap;gap:10px;margin-top:24px}
.history-welcome>div span{font-size:11px;color:#a8bdd8;border:1px solid var(--border-color);border-radius:6px;padding:7px 10px}
#history-observations:has(#history-detail:not([hidden]))>#history-welcome{display:none}
@container(min-width:880px){
 #history-observations{display:grid;grid-template-columns:300px minmax(0,1fr);gap:20px;align-items:start}
 #history-observations>.tool-panel{min-width:0;margin-bottom:0;padding:22px}
 #history-observations #history-search{display:grid;grid-template-columns:1fr;gap:14px}
 #history-observations .history-match{display:flex;flex-direction:column;gap:6px;padding:16px}
 #history-observations .history-match strong{font-size:13px}
 #history-observations .history-match small{font-size:11px;line-height:1.5}
 #history-observations .history-list{max-height:540px}
 #history-observations #history-detail{position:sticky;top:24px}
 #history-detail .tool-toolbar{display:grid;grid-template-columns:140px minmax(0,1fr)}
 #history-detail .tool-toolbar label{width:100%;min-width:0}
 #history-detail h2{font-size:22px;line-height:1.4;letter-spacing:-.5px}
 #history-detail .tool-message{padding:8px 0;font-size:12px}
 #history-values{max-height:320px;overflow:auto}
 .history-welcome.tool-panel{padding:36px!important;min-height:570px}
}
@container(max-width:879px){.history-welcome{display:none}.profile-layout{grid-template-columns:1fr}.profile-layout>section{min-width:0}}
.profile-layout>.tool-panel{border-radius:16px;background:linear-gradient(135deg,#15223655,transparent 60%),var(--bg-card)}
.profile-layout .profile-entry{padding:20px;border-radius:12px;box-shadow:inset 0 1px #e0edff08}
.profile-layout .profile-grid{gap:20px}
.profile-layout h2{font-size:21px;letter-spacing:-.4px}.profile-layout .profile-grid h3{font-size:16px}
.profile-layout .tool-toolbar+.tool-message{padding-top:0}
@media(max-width:600px){.tool-head>.tool-art{width:62px;height:62px}.tool-head{gap:18px}.tool-head h1{font-size:28px}.tool-head p{font-size:13px}.profile-layout .profile-grid{gap:16px}}

/* Match history facets expose the recorded selections instead of opaque hashes. */
.history-filter-panel{padding:18px;margin:18px 0;border:1px solid #3b5270;border-radius:13px;background:linear-gradient(135deg,#22344d55,#101a2a);box-shadow:inset 0 1px #d6e9ff16}
.history-filter-heading{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:17px;font-size:13px;font-weight:600}
.history-filter-heading .text-button{border:0;background:none;color:var(--primary-blue);font:500 12px var(--font-family);cursor:pointer;padding:4px}
.history-filter-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}
.history-filter-grid label,.history-series-row label{display:grid;gap:7px;min-width:0;color:var(--text-secondary);font-size:11px;line-height:1.5}
.history-filter-grid .inp,.history-series-row .inp{margin:0;width:100%;min-width:0;height:44px;font-size:12px}
.history-filter-wide{grid-column:span 2}.history-filter-full{grid-column:1/-1}
.history-series-row{margin-top:16px}.history-series-row p{font-size:11px;line-height:1.65;color:var(--text-secondary);margin:10px 0 0}
.history-series-row>#history-more{width:auto;min-height:36px;padding:8px 12px;margin:12px 0 0;font-size:11px}
.history-selection-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:18px 0}
.history-selection-summary:has(>.history-selection-card:only-child){grid-template-columns:1fr}
.history-selection-card{display:grid;gap:8px;min-width:0;padding:17px;border:1px solid #486185;border-radius:12px;background:radial-gradient(ellipse at 0 0,#a9cfff12,transparent 75%),linear-gradient(135deg,#20324a,#101c2d);box-shadow:inset 0 1px #d9eaff21}
.history-selection-card small{font-size:12px;color:#a9cdff;font-weight:600}.history-selection-card strong{font-size:17px;line-height:1.5;overflow-wrap:anywhere}.history-selection-card span{font-size:11px;color:var(--text-secondary);line-height:1.6}
.history-settings{border-bottom:1px solid var(--border-color);padding:0 0 16px;margin:16px 0;font-size:12px;color:var(--text-secondary)}
.history-settings summary{color:#b9cfea;cursor:pointer;min-height:26px}
.history-settings dl{display:grid;gap:12px;padding:15px 0 0;margin:0}.history-settings dl>div{display:grid;grid-template-columns:135px minmax(0,1fr);gap:15px;line-height:1.65}.history-settings dt{color:var(--text-secondary)}.history-settings dd{margin:0;color:var(--text-primary);overflow-wrap:anywhere}
.history-filter-panel [hidden],.history-selection-summary[hidden],.history-settings[hidden]{display:none!important}
.tool-head>.tool-art[src*="history-v2"]{width:112px;height:112px}.history-welcome>img[src*="history-v2"]{width:120px;height:120px}
@media(max-width:600px){.history-filter-panel{padding:15px}.history-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.history-filter-grid label:nth-child(3){grid-column:1/-1}.history-filter-wide{grid-column:1/-1}.history-selection-summary{grid-template-columns:1fr}.history-settings dl>div{grid-template-columns:1fr;gap:3px}.history-filter-grid .inp{font-size:13px}}
@media(max-width:600px){.tool-head>.tool-art[src*="history-v2"]{width:80px;height:80px}}
