/* GEOMETRY STUDIO 2D v1.4 — BUILD 04 · chỉ trong Standalone geometry_2d. */
.g2d-standalone-page #g2d-topbar .g2d-toolbar-strip {align-items:center!important;min-height:54px;}
.g2d-standalone-page #g2d-topbar .g2d-toolbar-strip > .g2d-shell-icon-btn,
.g2d-standalone-page #g2d-topbar .g2d-top-actions .g2d-shell-icon-btn,
.g2d-standalone-page #g2d-topbar .g2d-toolbar-restore,
.g2d-standalone-page #g2d-topbar .g2d-text-menu-toggle {
  box-sizing:border-box!important;height:48px!important;min-height:48px!important;max-height:48px!important;
  width:48px!important;min-width:48px!important;padding:7px!important;
  border:1px solid #c4d9f4;border-radius:11px;display:inline-flex;justify-content:center;align-items:center;flex-shrink:0;
  background:linear-gradient(150deg,#fff,#eaf3ff);box-shadow:inset 0 1px 0 #fff,0 2px 6px #2b5b9420;
}
.g2d-standalone-page #g2d-topbar .g2d-shell-icon-btn svg,
.g2d-standalone-page #g2d-topbar .g2d-toolbar-restore svg {
  width:30px!important;height:30px!important;max-width:30px!important;max-height:30px!important;stroke-width:1.85;
}
.g2d-standalone-page #g2d-topbar .g2d-brand-button {height:48px!important;min-height:48px!important;max-height:48px!important;width:60px!important;min-width:60px!important;padding:0!important;}
.g2d-standalone-page #g2d-topbar .g2d-brand-logo {height:43px!important;max-height:43px!important;width:57px!important;object-fit:contain;}
.g2d-standalone-page #g2d-topbar .g2d-top-actions{padding-top:0!important;align-items:center!important;}
.g2d-standalone-page #g2d-topbar .g2d-toolbar-shell{align-self:center;}
.g2d-standalone-page #g2d-topbar .g2d-text-menu-toggle{width:auto!important;min-width:66px!important;padding-inline:10px!important;font-weight:750;gap:5px;white-space:nowrap;color:#1454a4;}
.g2d-standalone-page #g2d-topbar[data-toolbar-orientation="vertical"] .g2d-toolbar-strip{align-items:center!important;}
.g2d-standalone-page .g2d-status-zoom{font-weight:750;border-radius:999px;min-height:34px;padding:5px 12px;background:#f8fbff;white-space:nowrap;}
.g2d-standalone-page .g2d-status-zoom:hover,.g2d-standalone-page .g2d-status-zoom:focus-visible{background:#e6f2ff;border-color:#609de8;}
.g2d-standalone-page .g2d-classic-menu-bar {display:flex;flex-wrap:wrap;align-items:center;gap:2px;padding:3px 8px 6px;border-top:1px solid #d9e8f9;}
.g2d-standalone-page .g2d-classic-menu-bar[hidden]{display:none!important;}
.g2d-standalone-page .g2d-classic-menu-button {border:0;border-radius:7px;background:transparent;color:#234976;font-size:14px;font-weight:650;padding:7px 13px;min-height:36px;}
.g2d-standalone-page .g2d-classic-menu-button:hover,.g2d-standalone-page .g2d-classic-menu-button[aria-expanded="true"]{background:#e2efff;color:#0757ba;}
.g2d-standalone-page .g2d-text-menu-popup {position:fixed;z-index:1070;display:grid;gap:3px;min-width:245px;max-width:min(360px,calc(100vw - 16px));max-height:calc(100dvh - 16px);overflow-y:auto;overflow-x:hidden;padding:8px;border:1px solid #bad3f2;border-radius:12px;background:#fff;box-shadow:0 16px 36px #17467632;overscroll-behavior:contain;}
.g2d-standalone-page .g2d-text-menu-popup[hidden]{display:none!important;}
.g2d-standalone-page .g2d-text-menu-item{min-height:44px;width:100%;padding:8px 12px;text-align:left;background:transparent;border:0;border-radius:8px;color:#173965;font-size:14px;}
.g2d-standalone-page .g2d-text-menu-item:hover,.g2d-standalone-page .g2d-text-menu-item:focus-visible {background:#e7f2ff;outline:2px solid #83b2f1;outline-offset:-2px;}
.g2d-standalone-page .g2d-text-menu-category{font-weight:700;}
.g2d-standalone-page .g2d-text-menu-mode{border-top:1px solid #e4edf9;color:#135bb0;}
/* Menu công cụ con GeoGebra reference: nhấn mạnh hình vẽ, không thu hình vào viền dày. */
.g2d-standalone-page [data-toantin-tool="geometry_2d"] .g2d-palette-panel .g2d-premium-menu-item,
.g2d-standalone-page [data-toantin-tool="geometry_2d"].g2d-dropdown-menu[data-g2d-menu-portaled="true"] .g2d-premium-menu-item {
  min-height:58px!important;padding:5px 10px!important;gap:13px!important;font-size:15px!important;line-height:1.3!important;
}
.g2d-standalone-page [data-toantin-tool="geometry_2d"] .g2d-palette-panel .g2d-premium-menu-item [data-premium-icon],
.g2d-standalone-page [data-toantin-tool="geometry_2d"].g2d-dropdown-menu[data-g2d-menu-portaled="true"] .g2d-premium-menu-item [data-premium-icon]{
  box-sizing:border-box!important;width:46px!important;height:46px!important;min-width:46px!important;min-height:46px!important;
  max-width:46px!important;max-height:46px!important;padding:1px!important;flex:none!important;
  background:#fcfdff!important;border:1px solid #dbe8fa!important;border-radius:8px!important;
  filter:drop-shadow(0 1px 0 #ffffff);
}
@media(max-width:520px){.g2d-standalone-page #g2d-topbar .g2d-text-menu-toggle{min-width:48px!important;width:48px!important}.g2d-standalone-page #g2d-topbar .g2d-text-menu-toggle span{display:none;}}

/* BUILD04 — Ba nút Zoom cuối vùng dựng hình: − | 100% | +, bấm số để khôi phục tỷ lệ gốc. */
.g2d-standalone-page .g2d-zoom-bottom-controls {display:inline-flex;align-items:center;gap:4px;margin-inline:5px;flex-shrink:0;}
.g2d-standalone-page .g2d-zoom-bottom-controls button {
  display:inline-flex;justify-content:center;align-items:center;min-height:36px;height:36px;
  border:1px solid #bad2f6;border-radius:9px;background:#f7fbff;color:#1456b8;
  font-size:16px;font-weight:750;box-shadow:0 1px 3px #214d8a18;
}
.g2d-standalone-page .g2d-zoom-bottom-controls .g2d-zoom-step {width:36px;min-width:36px;font-size:24px;line-height:1;}
.g2d-standalone-page .g2d-zoom-bottom-controls .g2d-status-zoom {min-width:72px;padding-inline:12px;font-size:15px;}
.g2d-standalone-page .g2d-zoom-bottom-controls button:hover:not(:disabled),
.g2d-standalone-page .g2d-zoom-bottom-controls button:focus-visible {background:#e5f1ff;border-color:#448ce9;outline:2px solid #82b6fb;outline-offset:1px;}
.g2d-standalone-page .g2d-zoom-bottom-controls button:disabled {opacity:.45;cursor:not-allowed;}

/* BUILD04 — Không cuộn TOÀN TRANG ở 2D; hai vùng dài tự cuộn riêng.
   Layout 3D, fullscreen immersive và Host khác không bị áp dụng quy tắc này. */
body.g2d-standalone-page:has(.g2d-standalone-shell[data-studio-mode="2d"]:not([data-g2d-immersive-active="true"])) {
  height:100dvh;min-height:0!important;overflow:hidden!important;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"]:not([data-g2d-immersive-active="true"]) {
  box-sizing:border-box;height:100dvh;min-height:0!important;max-height:100dvh;
  display:flex;flex-direction:column;overflow:hidden!important;padding-bottom:3px!important;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"]:not([data-g2d-immersive-active="true"]) > .row {
  flex:1 1 auto;min-height:0;height:0;overflow:hidden;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] > .row > #presentation-column,
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] > .row > #full-column {
  display:flex;flex-direction:column;min-height:0;max-height:100%;overflow:hidden;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .g2d-workspace-card,
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .g2d-full-card {
  flex:1 1 auto;display:flex;flex-direction:column;min-height:0!important;max-height:none!important;height:100%!important;
  overflow:hidden!important;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .g2d-workspace-card > .card-header,
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .g2d-workspace-card > .card-footer,
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .g2d-full-card > .card-header {flex:0 0 auto;}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .g2d-canvas-body {
  flex:1 1 auto;min-height:0!important;height:auto!important;overflow:hidden!important;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .g2d-presentation-host {
  display:block;height:100%!important;min-height:0!important;max-height:100%!important;overflow:hidden!important;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] #full-panel-body {
  flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .g2d-footer {
  flex:0 0 auto;margin-top:0!important;padding-top:2px;line-height:1.1;
}
/* Khi cửa sổ hẹp, hai vùng được phân bổ chiều cao trong cùng màn hình, không kéo dài trang. */
@media(max-width:1199.98px) {
 .g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] > .row {flex-direction:column;flex-wrap:nowrap;}
 .g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] > .row > #presentation-column {flex:1 1 65%;height:65%;max-height:100%;}
 .g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] > .row > #full-column {flex:1 1 35%;height:35%;max-height:100%;}
}
/* BUILD24: một nút chuyển 2D/3D duy nhất, giữ đúng chiều cao 48 px của hàng. */
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .gs3d-mode-switch {
  min-height:48px;max-height:48px;height:48px;box-sizing:border-box;align-self:center;
}
.g2d-standalone-page .g2d-standalone-shell[data-studio-mode="2d"] .gs3d-mode-switch .gs3d-mode-toggle {
  height:42px;min-height:42px;max-height:42px;align-self:center;box-sizing:border-box;
}

/* BUILD07 · Owner: 3 end-chrome controls match 48px toolbar and 32px SVG. */
.g2d-standalone-page #g2d-topbar #toggle-fullscreen,
.g2d-standalone-page #g2d-topbar #open-toolbar-help,
.g2d-standalone-page #g2d-topbar #toggle-toolbar{
 box-sizing:border-box!important;width:48px!important;height:48px!important;min-width:48px!important;min-height:48px!important;max-width:48px!important;max-height:48px!important;padding:7px!important;}
.g2d-standalone-page #g2d-topbar #toggle-fullscreen svg,
.g2d-standalone-page #g2d-topbar #open-toolbar-help svg,
.g2d-standalone-page #g2d-topbar #toggle-toolbar svg{
 width:32px!important;height:32px!important;min-width:32px!important;min-height:32px!important;max-width:32px!important;max-height:32px!important;stroke-width:2.3!important;}
.g2d-standalone-page .g2d-footer{font-size:12px;white-space:normal;line-height:1.3;}

/* BUILD07: Standalone right header only; never injected into Host CSS. */
.g2d-standalone-page #g2d-right-card > .card-header{gap:3px!important;flex-wrap:nowrap!important;min-width:0;}
.g2d-standalone-page #g2d-right-card > .card-header .g2d-right-panel-title{font-size:14px;white-space:nowrap;flex-shrink:1;min-width:0;}
.g2d-standalone-page #g2d-right-card > .card-header .g2d-panel-action-row{flex:0 0 auto;flex-wrap:nowrap!important;gap:3px!important;margin-left:auto;}
.g2d-standalone-page #g2d-right-card > .card-header .ms-auto{margin-left:0!important;flex:0 0 auto;gap:3px!important;}
.g2d-standalone-page #g2d-right-card > .card-header .g2d-panel-icon-btn,
.g2d-standalone-page #g2d-right-card > .card-header .g2d-export-toggle,
.g2d-standalone-page #g2d-right-card > .card-header .g2d-shell-icon-btn{height:34px!important;width:34px!important;min-width:34px!important;min-height:34px!important;max-height:34px!important;max-width:34px!important;padding:5px!important;border-radius:8px!important;}
.g2d-standalone-page #g2d-right-card > .card-header svg{width:22px!important;height:22px!important;max-width:22px!important;max-height:22px!important;}

/* BUILD09 hover submenus: fixed overlay avoids parent palette clipping. */
.g2d-standalone-page .g2d-text-hover-sub{z-index:1080;min-width:250px;max-height:calc(100dvh - 16px);overflow-y:auto;}

/* BUILD24 / Owner: 3D mode switch is ORANGE and distinctly raised, WITHOUT
   resizing toolbar rows, moving neighbors or changing 2D/3D functionality.
   This is scoped to Standalone chrome; Host owns its own toolbar. */
.g2d-standalone-page .gs3d-mode-switch .gs3d-mode-toggle[data-studio-mode="3d"] {
  position:relative;
  z-index:1;
  color:#532704;
  font-weight:900;
  letter-spacing:.025em;
  border:1px solid #b8520b;
  border-bottom-color:#863508;
  border-radius:9px;
  background:linear-gradient(155deg,#ffe9ad 0%,#ffc45e 27%,#ffa229 61%,#ec790b 100%);
  text-shadow:0 1px 0 rgba(255,255,255,.53);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.92),
             inset 0 -1px 0 rgba(147,62,4,.2),
             0 3px 0 #a34b0a,
             0 5px 11px rgba(128,58,7,.32);
  transform:translateY(-2px);
  transition:transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.g2d-standalone-page .gs3d-mode-switch .gs3d-mode-toggle[data-studio-mode="3d"]:hover {
  background:linear-gradient(155deg,#fff1bb 0%,#ffd077 28%,#ffac35 63%,#f5840d 100%);
  transform:translateY(-3px);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.96),
             0 4px 0 #984106,
             0 7px 15px rgba(120,48,4,.39);
}
.g2d-standalone-page .gs3d-mode-switch .gs3d-mode-toggle[data-studio-mode="3d"]:active {
  transform:translateY(1px);
  box-shadow:inset 0 2px 4px rgba(112,41,2,.19),0 1px 0 #a34b0a;
}
.g2d-standalone-page .gs3d-mode-switch .gs3d-mode-toggle[data-studio-mode="3d"]:focus-visible {
  outline:3px solid #1667e8;
  outline-offset:2px;
}
/* After switching to 3D the same control is labelled 2D; keep that return
   action legible but blue, rather than misleadingly branding it “3D”. */
.g2d-standalone-page .gs3d-mode-switch .gs3d-mode-toggle[data-studio-mode="2d"] {
  background:linear-gradient(165deg,#eaf3ff,#c9e0ff);
  color:#174982;
  border-color:#8eafd9;
  box-shadow:inset 0 1px 0 #fff,0 2px 0 #7f9bc0,0 4px 8px rgba(31,70,125,.18);
}
@media(prefers-reduced-motion:reduce) {
 .g2d-standalone-page .gs3d-mode-switch .gs3d-mode-toggle[data-studio-mode="3d"] {transition:none;}
}
