/* Graph 2 - the phone's sheets (graph2_sheets.js): the drawing tools and the chart menu, from the bottom of the
   screen; and the phone's own close buttons on the panels they open. Theme tokens from graph2.css. */

/* the phone buttons and close buttons exist on a phone only */
@media (min-width:701px){ .g2-phone-btn,.g2-phone-x{display:none !important} }

/* ---------- the sheet ---------- */
.g2s-back{position:fixed;inset:0;z-index:1190;background:rgba(5,8,14,.52);animation:g2s-fade .18s ease-out;-webkit-tap-highlight-color:transparent}
.g2s{position:fixed;left:0;right:0;bottom:0;z-index:1200;display:flex;flex-direction:column;max-height:86vh;max-height:86dvh;
  background:var(--panel);color:var(--text);border-radius:22px 22px 0 0;border-top:1px solid var(--line);
  box-shadow:0 -14px 44px rgba(0,0,0,.38);padding-bottom:env(safe-area-inset-bottom);
  font:14px/1.35 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  animation:g2s-up .24s cubic-bezier(.2,.85,.25,1);transition:transform .2s ease;overscroll-behavior:contain}
.g2s.g2s-out{transform:translateY(100%);transition:transform .18s ease-in}
.g2s-back.g2s-out{opacity:0;transition:opacity .18s ease-in}
@keyframes g2s-up{from{transform:translateY(100%)}to{transform:none}}
@keyframes g2s-fade{from{opacity:0}to{opacity:1}}
[data-theme="light"] .g2s{box-shadow:0 -12px 40px rgba(16,22,40,.18)}
[data-theme="light"] .g2s-back{background:rgba(16,22,40,.34)}
@media (min-width:701px){ .g2s{left:50%;right:auto;width:min(520px,100vw);transform:translateX(-50%)} .g2s.g2s-out{transform:translate(-50%,100%)} }

.g2s *{box-sizing:border-box}
.g2s-top{flex:none;padding:8px 14px 2px;touch-action:none;cursor:grab}
.g2s-grab{display:block;width:42px;height:5px;border-radius:3px;background:var(--line);margin:0 auto 8px}
[data-theme="dark"] .g2s-grab,:root:not([data-theme]) .g2s-grab{background:#3a3f4c}
.g2s-head{display:flex;align-items:center;gap:8px;min-height:40px}
.g2s-head b{flex:1;min-width:0;text-align:center;font:600 17px/1.2 "Source Serif 4",Georgia,serif;letter-spacing:-.005em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.g2s-hb{flex:none;width:38px;height:38px;border-radius:50%;border:0;background:var(--panel2);color:var(--text);display:grid;place-items:center;cursor:pointer;
  -webkit-tap-highlight-color:transparent;transition:transform .08s ease,background-color .12s}
.g2s-hb:active{transform:scale(.92)}
.g2s-hb .g2s-ic{width:18px;height:18px}
.g2s-hsp{flex:none;width:38px}
.g2s-ic{width:24px;height:24px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}

.g2s-search{flex:none;display:flex;align-items:center;gap:10px;height:44px;margin:8px 14px 2px;padding:0 6px 0 14px;border-radius:13px;
  background:var(--panel2);border:1px solid transparent;color:var(--muted);transition:border-color .12s}
.g2s-search:focus-within{border-color:var(--accent)}
.g2s-search .g2s-ic{width:18px;height:18px}
.g2s-search input{flex:1;min-width:0;height:100%;border:0;background:none;outline:none;color:var(--text);font:inherit;font-size:16px;-webkit-appearance:none;appearance:none}
.g2s-search input::-webkit-search-cancel-button{display:none}
.g2s-search input::placeholder{color:var(--muted)}
.g2s-clr{flex:none;width:32px;height:32px;border-radius:50%;border:0;background:none;color:var(--muted);display:grid;place-items:center;cursor:pointer}
.g2s-clr[hidden]{display:none}
.g2s-clr .g2s-ic{width:16px;height:16px}

.g2s-chips{flex:none;display:flex;gap:8px;overflow-x:auto;padding:10px 14px 4px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.g2s-chips::-webkit-scrollbar{display:none}
.g2s-chip{flex:none;height:36px;padding:0 15px;border-radius:999px;border:1px solid var(--line);background:none;color:var(--text);
  font:600 13px/1 Inter,-apple-system,"Segoe UI",sans-serif;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;
  transition:background-color .12s,color .12s,border-color .12s}
.g2s-chip.on{background:var(--text);border-color:var(--text);color:var(--panel)}

.g2s-body{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:2px 14px 18px}
.g2s-sec{margin-top:12px}
.g2s-h{margin:4px 2px 9px;font:700 11px/1 Inter,-apple-system,"Segoe UI",sans-serif;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.g2s-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.g2s-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-height:82px;padding:12px 6px 10px;
  border-radius:15px;border:1px solid transparent;background:var(--panel2);color:var(--text);cursor:pointer;
  font:600 12.5px/1.25 Inter,-apple-system,"Segoe UI",sans-serif;text-align:center;-webkit-tap-highlight-color:transparent;
  transition:transform .08s ease,background-color .12s,border-color .12s,color .12s}
.g2s-tile:active{transform:scale(.95)}
.g2s-tile span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;max-width:100%;word-break:break-word}
.g2s-tile svg{width:25px;height:25px;flex:none}
.g2s-tile .g2d-ic{width:25px;height:25px;stroke-width:1.6}
.g2s-tile .ic{width:25px;height:25px}
.g2s-tile.on{border-color:var(--accent);background:rgba(41,98,255,.14);color:var(--accent)}
[data-theme="light"] .g2s-tile.on{background:rgba(41,98,255,.08)}
.g2s-tile.danger{color:var(--down)}
.g2s-tile:disabled{opacity:.38;cursor:default}
.g2s-tile:disabled:active{transform:none}
.g2s-badge{position:absolute;top:6px;right:6px;padding:2px 5px;border-radius:6px;font:700 8.5px/1 Inter,sans-serif;font-style:normal;letter-spacing:.03em;
  color:#17130a;background:linear-gradient(145deg,#ffcf6b,#f5b942)}
.g2s-empty{margin:28px 0;text-align:center;color:var(--muted)}
@media (hover:hover){
  .g2s-tile:not(:disabled):not(.on):hover{border-color:var(--line)}
  .g2s-chip:not(.on):hover{border-color:var(--muted)}
}
@media (max-width:340px){ .g2s-tile{min-height:76px;font-size:11.5px} .g2s-grid{gap:7px} }
@media (prefers-reduced-motion:reduce){ .g2s,.g2s-back{animation:none} .g2s,.g2s-tile,.g2s-hb,.g2s-chip{transition:none} }

/* ---------- the phone's top bar: even icon buttons with room between them, the colour on the icon itself ---------- */
@media (max-width:700px){
  #g2-top{gap:3px;padding:0 5px}
  #g2-top #g2-patterns-btn,#g2-top #g2-ai-btn,#g2-top .g2-phone-btn,#g2-top #g2-side-toggle{position:relative;width:34px;height:36px;padding:0;
    justify-content:center;border:0;border-radius:10px;background:none;-webkit-tap-highlight-color:transparent;transition:background-color .12s}
  #g2-top #g2-patterns-btn .ic,#g2-top #g2-ai-btn .ic,#g2-top .g2-phone-btn .ic,#g2-top #g2-side-toggle .ic{width:20px;height:20px}
  #g2-top #g2-patterns-btn,#g2-top #g2-patterns-btn:hover{background:none;color:var(--accent)}
  [data-theme="dark"] #g2-top #g2-patterns-btn,:root:not([data-theme]) #g2-top #g2-patterns-btn{color:#6d93ff}
  #g2-top #g2-ai-btn,#g2-top #g2-ai-btn:hover{background:none;border:0}
  #g2-top #g2-ai-btn .ic{color:#9d86ff}
  #g2-top #g2-patterns-btn:active,#g2-top #g2-ai-btn:active,#g2-top .g2-phone-btn:active,#g2-top #g2-side-toggle:active{background:var(--hover)}
  /* the number of patterns on the chart: a small badge on the icon's corner */
  #g2-top #g2-patterns-btn .g2-count{position:absolute;top:1px;right:-2px;min-width:15px;height:15px;margin:0;padding:0 4px;border-radius:8px;
    font-size:9.5px;line-height:15px;text-align:center}
  /* a picked drawing tool: the Draw icon in blue with a dot under it */
  #g2-top #g2-draw-btn.active{color:var(--accent);background:none}
  #g2-top #g2-draw-btn.active::after{content:"";position:absolute;left:50%;bottom:2px;width:4px;height:4px;margin-left:-2px;border-radius:50%;background:var(--accent)}
  #g2-app.g2-fit6 #g2-top .g2-symbol{max-width:86px}
  #g2-app.g2-fit9 #g2-top .g2-symbol{max-width:70px}
  /* the buttons keep their size: only the symbol's name gives (down to a short one); past that the bar steps down */
  #g2-top > *{flex-shrink:0}
  #g2-top > .g2-spacer{flex-shrink:1}
  #g2-top > #g2-symbol-btn{flex-shrink:1;min-width:64px}
}

/* ---------- panels opened from the sheets: on a phone, sheets with a close button ---------- */
.g2-lm-x,.g2d-lx{display:none}
@media (max-width:700px){
  /* layouts */
  #g2-top .g2-menu.g2-lm-menu{position:fixed;left:0;right:0;bottom:0;top:auto;width:auto;max-width:none;max-height:86vh;max-height:86dvh;overflow-y:auto;
    margin:0;padding:16px 14px calc(16px + env(safe-area-inset-bottom));border-radius:22px 22px 0 0;z-index:1200;
    box-shadow:0 0 0 100vmax rgba(5,8,14,.52),0 -14px 44px rgba(0,0,0,.38)}
  #g2-top .g2-lm-x{display:grid;place-items:center;position:absolute;top:12px;right:12px;width:38px;height:38px;border-radius:50%;border:0;
    background:var(--panel2);color:var(--text);cursor:pointer;z-index:2}
  #g2-top .g2-lm-x .ic{width:18px;height:18px}
  #g2-top .g2-lm-menu .g2-lm-top{padding-right:46px}
  #g2-top .g2-lm-menu .g2-lm-ask{padding-top:28px}
  /* the drawings list */
  .g2d-pop.g2d-list{left:0 !important;right:0 !important;top:auto !important;bottom:0 !important;width:auto !important;max-width:none !important;
    max-height:72vh;border-radius:22px 22px 0 0 !important;padding-bottom:env(safe-area-inset-bottom);
    box-shadow:0 0 0 100vmax rgba(5,8,14,.52),0 -14px 44px rgba(0,0,0,.38) !important}
  .g2d-list .g2d-menu-h{display:flex;align-items:center;gap:6px}
  .g2d-list .g2d-lx{display:grid;place-items:center;margin-left:auto;width:34px;height:34px;border-radius:50%;border:0;background:var(--panel2);color:var(--text);cursor:pointer}
  /* the side panel (watchlist, alerts ...) */
  #g2-side-x{display:inline-flex;margin-left:auto;flex:none}
  /* the hint while a tool is picked: a Stop button instead of "Esc to cancel" */
  #g2-hint:not([hidden]){display:flex;align-items:center;gap:8px;padding:5px 6px 5px 14px;max-width:calc(100% - 16px)}
  #g2-hint .g2-hint-t{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #g2-hint .g2-hint-esc{display:none}
  #g2-hint .g2-hint-stop{display:inline-flex}
}
.g2-hint-stop{display:none;flex:none;align-items:center;height:28px;padding:0 12px;border-radius:999px;border:0;background:#fff;color:var(--accent);
  font:700 12px/1 Inter,-apple-system,"Segoe UI",sans-serif;cursor:pointer;-webkit-tap-highlight-color:transparent}
.g2-hint-stop:active{transform:scale(.95)}
