.phg-app,
.phg-app * {
  box-sizing: border-box;
}

.phg-app {
  --phg-navy: #0c2443;
  --phg-navy-2: #12345c;
  --phg-blue: #2878ff;
  --phg-cyan: #32c8ff;
  --phg-ink: #17283d;
  --phg-muted: #687b91;
  --phg-line: #d8e3ef;
  --phg-panel: #ffffff;
  --phg-stage: #f7fbff;
  position: relative;
  width: 100%;
  max-width: 1500px;
  min-width: 0;
  margin: 22px auto;
  overflow: hidden;
  border: 1px solid #d8e4ef;
  border-radius: 24px;
  background: #eaf2f9;
  color: var(--phg-ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 24px 70px rgba(13, 37, 65, .16);
  isolation: isolate;
}

.phg-app:focus { outline: none; }

.phg-app button,
.phg-app input {
  font: inherit;
}

.phg-app button {
  appearance: none;
  -webkit-appearance: none;
}

.phg-header {
  min-height: 74px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 28% 0%, rgba(50, 200, 255, .24), transparent 30%),
    linear-gradient(120deg, #081d37 0%, #0d2a4f 52%, #123f6d 100%);
}

.phg-brand,
.phg-header-actions,
.phg-mini-button,
.phg-active-tool,
.phg-scale-note,
.phg-statusbar > span {
  display: flex;
  align-items: center;
}

.phg-brand { gap: 12px; min-width: 230px; }
.phg-brand strong { display: block; font-size: clamp(18px, 2vw, 25px); line-height: 1.1; letter-spacing: -.02em; }
.phg-brand small { display: block; margin-top: 4px; color: #9edfff; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.phg-brand-mark {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #32c8ff, #2777ff);
  box-shadow: 0 8px 20px rgba(39, 119, 255, .36), inset 0 1px 0 rgba(255, 255, 255, .45);
}

.phg-brand-mark span { position: absolute; height: 2px; border-radius: 99px; background: #fff; transform-origin: left center; }
.phg-brand-mark span:nth-child(1) { width: 23px; left: 9px; top: 28px; transform: rotate(-50deg); }
.phg-brand-mark span:nth-child(2) { width: 16px; left: 18px; top: 10px; transform: rotate(58deg); }
.phg-brand-mark span:nth-child(3) { width: 19px; left: 9px; top: 28px; transform: rotate(3deg); }

.phg-header-actions { justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.phg-mini-button {
  min-height: 38px;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .18) !important;
  border-radius: 11px !important;
  color: #dbeeff !important;
  background: rgba(255, 255, 255, .07) !important;
  box-shadow: none !important;
  font-size: 12px;
  font-weight: 800;
  line-height: 1 !important;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.phg-mini-button:hover,
.phg-mini-button:focus-visible,
.phg-mini-button.is-on { color: #fff !important; border-color: rgba(97, 213, 255, .75) !important; background: rgba(50, 200, 255, .2) !important; }
.phg-mini-button:hover { transform: translateY(-1px); }
.phg-mini-button .phg-icon { width: 17px; height: 17px; }

.phg-workbench {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 108px;
  min-height: 640px;
  background: linear-gradient(180deg, #eef5fb 0%, #e7f0f8 100%);
}

.phg-toolbar {
  position: relative;
  z-index: 5;
  padding: 14px 11px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 25px rgba(20, 51, 83, .08);
}

.phg-toolbar-left { border-right: 1px solid var(--phg-line); }
.phg-toolbar-right { border-left: 1px solid var(--phg-line); }
.phg-toolbar-title { display: block; margin: 0 0 2px; color: #8a9aad; font-size: 9px; font-weight: 900; letter-spacing: .16em; text-align: center; }

.phg-tool-slot {
  position: relative;
  width: 100%;
  flex: 0 0 auto;
}

.phg-tool-button {
  position: relative;
  width: 100%;
  min-height: 58px;
  padding: 7px 5px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid transparent !important;
  border-radius: 13px !important;
  color: #3f5268 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 1 !important;
  line-height: 1.1 !important;
  text-shadow: none !important;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}

.phg-tool-button:hover,
.phg-tool-button:focus-visible {
  color: #145bbb !important;
  border-color: #cde1f6 !important;
  background: #f0f7ff !important;
  transform: translateY(-1px);
}

.phg-tool-button.is-active {
  color: #fff !important;
  border-color: #2777ff !important;
  background: linear-gradient(145deg, #2f88ff, #1d64e8) !important;
  box-shadow: 0 9px 18px rgba(38, 112, 239, .25) !important;
}

.phg-tool-button.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 18px;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: #2b80ff;
}

.phg-toolbar-right .phg-tool-button.is-active::before { left: auto; right: -12px; border-radius: 3px 0 0 3px; }
.phg-tool-icon { display: grid; place-items: center; width: 28px; height: 28px; }
.phg-tool-label { display: block; color: inherit !important; opacity: 1 !important; font-size: 11px; font-weight: 800; white-space: nowrap; }
[data-panel="lines"] .phg-tool-label { font-size: 9px; white-space: normal; text-align: center; }
.phg-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.phg-tool-info {
  position: absolute;
  z-index: 3;
  top: 3px;
  right: 3px;
  width: 17px;
  height: 17px;
  min-width: 17px !important;
  min-height: 17px !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center;
  border: 1px solid #b9cce0 !important;
  border-radius: 50% !important;
  color: #52708e !important;
  background: rgba(255,255,255,.94) !important;
  box-shadow: 0 2px 6px rgba(16,48,78,.1) !important;
  font: 900 10px/1 Georgia, serif !important;
  cursor: pointer;
}
.phg-tool-info:hover,
.phg-tool-info:focus-visible { color: #fff !important; border-color: #2878ff !important; background: #2878ff !important; }
.phg-tool-button.is-active + .phg-tool-info { color: #1d64d8 !important; border-color: #b7d4ff !important; }

.phg-stage-card { position: relative; min-width: 0; padding: 14px; background: transparent; }
.phg-canvas-toolbar { min-height: 48px; display: grid; grid-template-columns: auto auto minmax(240px, 1fr); align-items: center; gap: 12px; padding: 0 4px 10px; }
.phg-active-tool { gap: 7px; font-size: 13px; }
.phg-active-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--phg-blue); box-shadow: 0 0 0 4px rgba(40, 120, 255, .12); }
.phg-scale-note { gap: 8px; color: var(--phg-muted); font-size: 11px; font-weight: 700; }
.phg-scale-line { position: relative; width: 28px; height: 1px; background: #6f8399; }
.phg-scale-line::before, .phg-scale-line::after { content: ""; position: absolute; top: -3px; width: 1px; height: 7px; background: #6f8399; }
.phg-scale-line::before { left: 0; } .phg-scale-line::after { right: 0; }
.phg-hint { min-width: 0; overflow: hidden; color: #71839a; font-size: 11px; font-weight: 650; text-align: right; text-overflow: ellipsis; white-space: nowrap; }

.phg-measure-screen {
  min-width: 0;
  max-width: 560px;
  justify-self: end;
  padding: 6px 10px 6px 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #b9cee2;
  border-radius: 10px;
  color: #dff5ff;
  background: linear-gradient(135deg, #102f50, #0b223d);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 5px 14px rgba(16,47,80,.13);
}
.phg-screen-icon { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border-radius: 7px; color: #06233e; background: #58d6ff; font-size: 19px; }
.phg-measure-screen div { min-width: 0; }
.phg-measure-screen small { display: block; margin-bottom: 1px; color: #79caec; font-size: 7px; font-weight: 950; letter-spacing: .14em; }
.phg-measure-screen strong { display: block; overflow: hidden; color: #f0fbff; font-size: 10px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }

.phg-stage-wrap {
  position: relative;
  width: 100%;
  height: clamp(520px, 68vh, 720px);
  overflow: hidden;
  border: 1px solid #cdddec;
  border-radius: 18px;
  background: var(--phg-stage);
  box-shadow: 0 12px 30px rgba(20, 54, 86, .1), inset 0 1px 0 #fff;
  touch-action: none;
}

.phg-stage { display: block; width: 100%; height: 100%; overflow: hidden; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.phg-stage:focus { outline: none; }
.phg-stage.is-tool-eraser { cursor: cell; }
.phg-stage.is-tool-move { cursor: grab; }
.phg-stage.is-tool-move.is-dragging { cursor: grabbing; }
.phg-stage-bg { fill: #f9fcff; }
.phg-stage-bg.has-grid { fill: url(#phg-grid-pattern); }

.phg-drawing { cursor: inherit; }
.phg-drawing .phg-hit { fill: none; stroke: transparent; stroke-width: 12px; vector-effect: non-scaling-stroke; pointer-events: stroke; }
.phg-drawing .phg-main-stroke { vector-effect: non-scaling-stroke; pointer-events: stroke; }
.phg-drawing.is-selected .phg-main-stroke { filter: drop-shadow(0 0 2px rgba(25, 111, 255, .9)); }
.phg-drawing.is-selected .phg-selection-ring { display: block; }
.phg-selection-ring { display: none; fill: none; stroke: #2680ff; stroke-width: 1.5px; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.phg-measure-label { font: 800 11px Inter, ui-sans-serif, sans-serif; fill: #17314e; stroke: rgba(255,255,255,.94); stroke-width: 4px; paint-order: stroke; vector-effect: non-scaling-stroke; pointer-events: none; }
.phg-draft-stroke { fill: none; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }

.phg-instrument { filter: drop-shadow(0 7px 6px rgba(25, 47, 70, .16)); }
.phg-instrument-body { cursor: grab; }
.phg-instrument-body:active { cursor: grabbing; }
.phg-instrument text { font-family: Inter, ui-sans-serif, sans-serif; user-select: none; pointer-events: none; }
.phg-instrument .phg-instrument-handle { cursor: grab; fill: #fff; stroke: #1668d9; stroke-width: .08; }
.phg-instrument .phg-instrument-close { cursor: pointer; fill: #173b64; stroke: #fff; stroke-width: .06; }
.phg-instrument .phg-instrument-info { cursor: pointer; fill: #fff; stroke: #1f73d4; stroke-width: .07; }
.phg-instrument .phg-instrument-size-button { cursor: pointer; }
.phg-instrument .phg-instrument-size-button circle { fill: #173b64; stroke: #fff; stroke-width: .06; }
.phg-instrument .phg-instrument-size-button text { fill: #fff; }
.phg-instrument .phg-instrument-size-button:hover circle { fill: #2878ed; }
.phg-instrument .phg-compass-radius-handle { cursor: ew-resize; fill: #fff; stroke: #1676e8; stroke-width: .1; }
.phg-instrument .phg-compass-draw-handle { cursor: crosshair; fill: #fff; stroke: #ee3f5c; stroke-width: .12; }

.phg-measure-card {
  position: absolute;
  left: 14px;
  bottom: 14px;
  max-width: min(440px, calc(100% - 28px));
  min-height: 54px;
  padding: 9px 13px 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(34, 106, 181, .18);
  border-radius: 13px;
  color: #15314d;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 26px rgba(25, 60, 94, .14);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.phg-measure-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(145deg, #33c6ff, #2576ef); font-size: 23px; }
.phg-measure-card small { display: block; margin-bottom: 2px; color: #7b8fa3; font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.phg-measure-card strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.phg-cursor-badge { position: absolute; z-index: 4; transform: translate(12px, -50%); padding: 4px 7px; border: 1px solid #c9d9e8; border-radius: 7px; color: #17314e; background: rgba(255,255,255,.95); box-shadow: 0 5px 15px rgba(25, 60, 94, .12); font-size: 10px; font-weight: 900; pointer-events: none; }
.phg-statusbar { min-height: 31px; padding: 8px 4px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #708297; font-size: 10px; font-weight: 700; }
.phg-statusbar > span { gap: 6px; }
.phg-status-ready { width: 7px; height: 7px; border-radius: 50%; background: #16b979; box-shadow: 0 0 0 3px rgba(22,185,121,.12); }

.phg-education-note {
  margin-top: 10px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  border: 1px solid #bcd9f4;
  border-radius: 14px;
  background: linear-gradient(135deg, #f3f9ff, #fff);
  box-shadow: 0 8px 22px rgba(25, 83, 139, .07);
}
.phg-education-note[hidden] { display: none !important; }
.phg-note-badge { padding: 5px 7px; border-radius: 7px; color: #fff; background: linear-gradient(145deg,#2d88ff,#1762d2); font-size: 8px; font-weight: 950; letter-spacing: .12em; }
.phg-note-copy { min-width: 0; }
.phg-note-copy > strong { display: block; color: #173c63; font-size: 13px; }
.phg-note-copy p { margin: 3px 0 9px; color: #526b82; font-size: 11px; font-weight: 620; line-height: 1.48; }
.phg-note-symbols { display: flex; flex-wrap: wrap; gap: 6px; }
.phg-symbol-chip { min-height: 25px; padding: 5px 9px; display: inline-flex; align-items: center; border: 1px solid #cbdff2; border-radius: 8px; color: #1e4f7c; background: #fff; font: 800 11px/1.2 Georgia, serif; }
.phg-notation { position: relative; display: inline-block; min-width: 20px; padding-top: 3px; text-align: center; }
.phg-over-line { text-decoration: overline; text-decoration-thickness: 1px; }
.phg-over-both::before,
.phg-over-right::before { position: absolute; left: 50%; top: -7px; transform: translateX(-50%); color: #1e4f7c; font: 800 14px/1 Arial, sans-serif; }
.phg-over-both::before { content: "↔"; }
.phg-over-right::before { content: "→"; }
.phg-over-angle::before { content: "∠"; margin-right: 1px; }

.phg-popover {
  position: absolute;
  z-index: 20;
  top: 64px;
  left: 16px;
  width: min(340px, calc(100% - 32px));
  padding: 14px;
  border: 1px solid #d5e2ed;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(17, 47, 77, .2);
}
.phg-popover[hidden] { display: none !important; }
.phg-popover-head { margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.phg-popover-head strong { font-size: 13px; }
.phg-popover-head button { width: 29px; height: 29px; padding: 4px !important; display: grid; place-items: center; border: 0 !important; border-radius: 8px !important; color: #667a90 !important; background: #eef4f9 !important; box-shadow: none !important; cursor: pointer; }
.phg-popover-head .phg-icon { width: 17px; height: 17px; }
.phg-color-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.phg-color { position: relative; aspect-ratio: 1; min-width: 26px; padding: 0 !important; border: 2px solid #fff !important; border-radius: 50% !important; background: var(--swatch) !important; box-shadow: 0 0 0 1px #c6d4e1 !important; cursor: pointer; }
.phg-color.is-selected::after { content: ""; position: absolute; inset: -5px; border: 2px solid #2b7df5; border-radius: inherit; }
.phg-range-label { margin-top: 16px; display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; color: #65788e; font-size: 11px; font-weight: 800; }
.phg-range-label strong { color: #17314e; }
.phg-range-label input { grid-column: 1 / -1; width: 100%; accent-color: #2777ff; }

.phg-polygon-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.phg-polygon-grid button { min-width: 0; min-height: 66px; padding: 7px 3px !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1px solid #d9e4ee !important; border-radius: 11px !important; color: #4e6379 !important; background: #f8fbfe !important; box-shadow: none !important; font-size: 9px; font-weight: 800; cursor: pointer; }
.phg-polygon-grid button:hover, .phg-polygon-grid button:focus-visible { color: #1f69ce !important; border-color: #8ebcf5 !important; background: #eef6ff !important; }
.phg-shape-preview { width: 26px; height: 26px; background: linear-gradient(145deg, #6edcff, #2e7bff); clip-path: polygon(50% 0,100% 100%,0 100%); }
.phg-square { clip-path: polygon(0 0,100% 0,100% 100%,0 100%); }
.phg-pentagon { clip-path: polygon(50% 0,98% 35%,80% 100%,20% 100%,2% 35%); }
.phg-hexagon { clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); }
.phg-octagon { clip-path: polygon(30% 0,70% 0,100% 30%,100% 70%,70% 100%,30% 100%,0 70%,0 30%); }

.phg-line-mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.phg-line-mode-grid button { min-width: 0; min-height: 82px; padding: 8px 5px !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid #d7e3ee !important; border-radius: 11px !important; color: #425b73 !important; background: #f8fbfe !important; box-shadow: none !important; cursor: pointer; }
.phg-line-mode-grid button:hover,
.phg-line-mode-grid button:focus-visible,
.phg-line-mode-grid button.is-selected { color: #1768d2 !important; border-color: #77acf1 !important; background: #edf6ff !important; }
.phg-line-mode-grid button strong { font-size: 10px; line-height: 1.15; }
.phg-line-mode-grid button small { color: #7c8fa3; font-size: 8px; line-height: 1.2; }
.phg-line-preview { position: relative; width: 49px; height: 18px; display: block; }
.phg-line-preview i { position: absolute; left: 5px; right: 5px; top: 8px; height: 2px; border-radius: 99px; background: currentColor; }
.phg-line-segment::before, .phg-line-segment::after { content: ""; position: absolute; top: 5px; width: 7px; height: 7px; border: 2px solid currentColor; border-radius: 50%; background: #fff; }
.phg-line-segment::before { left: 1px; } .phg-line-segment::after { right: 1px; }
.phg-line-both::before, .phg-line-both::after, .phg-line-ray::after { content: ""; position: absolute; top: 4px; width: 8px; height: 8px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; }
.phg-line-both::before { left: 1px; transform: rotate(-135deg); }
.phg-line-both::after, .phg-line-ray::after { right: 1px; transform: rotate(45deg); }
.phg-line-ray::before { content: ""; position: absolute; left: 1px; top: 5px; width: 7px; height: 7px; border: 2px solid currentColor; border-radius: 50%; background: #fff; }

.phg-angle-mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.phg-angle-mode-grid button { min-width: 0; min-height: 92px; padding: 9px 7px !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid #d7e3ee !important; border-radius: 12px !important; color: #425b73 !important; background: #f8fbfe !important; box-shadow: none !important; cursor: pointer; }
.phg-angle-mode-grid button:hover,
.phg-angle-mode-grid button:focus-visible,
.phg-angle-mode-grid button.is-selected { color: #1768d2 !important; border-color: #77acf1 !important; background: #edf6ff !important; }
.phg-angle-mode-grid button strong { font-size: 11px; }
.phg-angle-mode-grid button small { color: #72879b; font-size: 8px; line-height: 1.25; text-align: center; }
.phg-angle-preview { position: relative; width: 55px; height: 27px; display: block; }
.phg-angle-preview i,
.phg-angle-preview b { position: absolute; left: 5px; bottom: 4px; width: 43px; height: 2px; border-radius: 99px; background: currentColor; transform-origin: left center; }
.phg-angle-preview b { transform: rotate(-38deg); }
.phg-angle-preview::after { content: ""; position: absolute; left: 10px; bottom: 5px; width: 12px; height: 8px; border-top: 1px solid currentColor; border-radius: 50%; transform: rotate(-20deg); }
.phg-angle-quiz-preview em { position: absolute; right: -1px; top: -1px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #ec4761; font: 900 11px/1 Arial,sans-serif; }

.phg-help-popover { left: auto; right: 16px; }
.phg-help-content { display: grid; grid-template-columns: 34px 1fr; align-items: start; gap: 10px; }
.phg-help-content > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(145deg,#33c7ff,#2676ee); font: 900 18px/1 Georgia,serif; }
.phg-help-content p { margin: 0; color: #526a81; font-size: 12px; font-weight: 650; line-height: 1.55; }

.phg-toast { position: absolute; z-index: 80; left: 50%; bottom: 46px; transform: translate(-50%, 12px); max-width: calc(100% - 28px); padding: 10px 15px; border-radius: 10px; color: #fff; background: #112f50; box-shadow: 0 12px 30px rgba(6, 27, 50, .25); font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.phg-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.phg-toast[hidden] { display: none !important; }

.phg-confirm { position: absolute; z-index: 100; inset: 0; display: grid; place-items: center; }
.phg-confirm[hidden] { display: none !important; }
.phg-confirm-backdrop { position: absolute; inset: 0; background: rgba(4, 18, 35, .54); backdrop-filter: blur(3px); }
.phg-confirm-dialog { position: relative; width: min(390px, calc(100% - 30px)); padding: 25px; border-radius: 19px; background: #fff; box-shadow: 0 28px 75px rgba(0,0,0,.3); text-align: center; }
.phg-confirm-symbol { width: 48px; height: 48px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 14px; color: #d53744; background: #fff0f1; }
.phg-confirm-dialog h3 { margin: 0 0 8px; color: #18314c; font-size: 20px; }
.phg-confirm-dialog p { margin: 0 0 20px; color: #6c7f93; font-size: 13px; line-height: 1.55; }
.phg-confirm-dialog > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.phg-confirm-dialog button { min-height: 42px; padding: 9px 14px !important; border-radius: 10px !important; box-shadow: none !important; font-size: 12px; font-weight: 900; cursor: pointer; }
.phg-confirm-secondary { border: 1px solid #d6e1eb !important; color: #52667a !important; background: #fff !important; }
.phg-confirm-danger { border: 1px solid #d53744 !important; color: #fff !important; background: #d53744 !important; }

.phg-embed-section { padding: 22px; border-top: 1px solid #d3e0ec; background: linear-gradient(135deg,#f8fbff,#eef6fd); }
.phg-embed-intro { margin-bottom: 13px; display: flex; align-items: center; gap: 12px; }
.phg-embed-intro > span { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg,#31c7ff,#2673ed); box-shadow: 0 8px 18px rgba(39,116,238,.2); }
.phg-embed-intro .phg-icon { width: 21px; height: 21px; }
.phg-embed-intro strong { color: #153653; font-size: 17px; }
.phg-embed-intro p { margin: 2px 0 0; color: #62798e; font-size: 11px; line-height: 1.45; }
.phg-embed-code-wrap { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: stretch; }
.phg-embed-code-wrap textarea { width: 100%; min-height: 110px; padding: 12px; resize: vertical; border: 1px solid #bdcee0; border-radius: 11px; color: #dff4ff; background: #0c2744; box-shadow: inset 0 1px 4px rgba(0,0,0,.2); font: 600 10px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.phg-embed-code-wrap button { min-width: 180px; padding: 12px 16px !important; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0 !important; border-radius: 11px !important; color: #fff !important; background: linear-gradient(145deg,#2c84ff,#1762d5) !important; box-shadow: 0 9px 20px rgba(32,105,218,.2) !important; font-size: 11px; font-weight: 900; cursor: pointer; }
.phg-embed-code-wrap .phg-icon { width: 17px; height: 17px; }
.phg-embed-warning { margin: 10px 0 0; color: #9a4b1f; font-size: 10px; font-weight: 750; line-height: 1.45; }

.phg-credit-lock { position: absolute; z-index: 200; inset: 0; padding: 20px; display: grid; place-items: center; color: #fff; background: rgba(6,24,44,.96); backdrop-filter: blur(8px); text-align: center; }
.phg-credit-lock[hidden] { display: none !important; }
.phg-credit-lock > div { max-width: 520px; padding: 28px; border: 1px solid rgba(117,210,255,.35); border-radius: 18px; background: rgba(15,55,91,.72); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.phg-credit-lock strong { display: block; font-size: 20px; }
.phg-credit-lock p { margin: 8px 0 0; color: #b9dcf2; font-size: 12px; line-height: 1.55; }

.phg-footer { min-height: 35px; padding: 9px 18px; color: #6b7f93; background: #fff; border-top: 1px solid #d8e4ef; font-size: 10px; font-weight: 650; text-align: center; }
.phg-footer a { color: #1e6ee3; font-weight: 900; text-decoration: none; }

.phg-app.is-fullscreen { position: fixed !important; z-index: 999999 !important; inset: 0 !important; max-width: none !important; height: 100dvh !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; }
.phg-app.is-fullscreen .phg-workbench { height: calc(100dvh - 109px); }
.phg-app.is-fullscreen .phg-stage-wrap { height: calc(100dvh - 194px); }

@media (max-width: 980px) {
  .phg-header { align-items: flex-start; }
  .phg-workbench { grid-template-columns: 88px minmax(0, 1fr) 88px; }
  .phg-toolbar { padding-inline: 8px; }
  .phg-tool-button { min-height: 54px; }
  .phg-tool-button.is-active::before { left: -9px; }
  .phg-toolbar-right .phg-tool-button.is-active::before { right: -9px; }
  .phg-canvas-toolbar { grid-template-columns: auto minmax(210px, 1fr); }
  .phg-scale-note { justify-self: end; }
  .phg-measure-screen { grid-column: 1 / -1; width: 100%; max-width: none; justify-self: stretch; }
  .phg-hint { display: none; }
}

@media (max-width: 720px) {
  .phg-app { margin: 8px auto; border-radius: 16px; }
  .phg-header { padding: 10px 12px; flex-direction: column; gap: 10px; }
  .phg-brand { min-width: 0; }
  .phg-brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .phg-brand strong { font-size: 19px; }
  .phg-header-actions { width: 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
  .phg-mini-button { flex: 0 0 auto; min-height: 35px; padding: 7px 9px; }
  .phg-workbench { display: flex; min-height: 0; flex-direction: column; }
  .phg-toolbar { padding: 7px 8px; flex-direction: row; overflow-x: auto; border: 0; scrollbar-width: thin; }
  .phg-toolbar-left { order: 1; border-bottom: 1px solid var(--phg-line); }
  .phg-stage-card { order: 2; padding: 8px; }
  .phg-toolbar-right { order: 3; justify-content: center; border-top: 1px solid var(--phg-line); }
  .phg-toolbar-title { display: none; }
  .phg-tool-slot { width: 70px; min-width: 70px; flex: 0 0 70px; }
  .phg-tool-button { width: 70px; min-width: 70px; min-height: 58px; }
  .phg-tool-button.is-active::before, .phg-toolbar-right .phg-tool-button.is-active::before { left: 22px; right: auto; top: -8px; width: 23px; height: 3px; border-radius: 0 0 3px 3px; }
  .phg-canvas-toolbar { min-height: 34px; padding: 0 2px 7px; }
  .phg-scale-note span:last-child { display: none; }
  .phg-stage-wrap { height: clamp(430px, 64dvh, 620px); border-radius: 13px; }
  .phg-statusbar span:last-child { display: none; }
  .phg-popover { top: 49px; left: 8px; width: calc(100% - 16px); }
  .phg-help-popover { left: 8px; right: auto; }
  .phg-measure-screen strong { font-size: 9px; }
  .phg-education-note { padding: 11px; grid-template-columns: 1fr; gap: 7px; }
  .phg-note-badge { width: max-content; }
  .phg-embed-section { padding: 16px 12px; }
  .phg-embed-code-wrap { grid-template-columns: 1fr; }
  .phg-embed-code-wrap button { min-width: 0; min-height: 43px; }
  .phg-footer { padding-inline: 10px; }
  .phg-app.is-fullscreen .phg-workbench { height: calc(100dvh - 122px); overflow-y: auto; }
  .phg-app.is-fullscreen .phg-stage-wrap { height: 65dvh; }
}

@media (max-width: 430px) {
  .phg-header-actions .phg-mini-button span { display: none; }
  .phg-mini-button { width: 39px; justify-content: center; }
  .phg-color-grid { grid-template-columns: repeat(4, 1fr); gap: 11px; }
  .phg-color { width: 32px; justify-self: center; }
  .phg-polygon-grid { grid-template-columns: repeat(3, 1fr); }
  .phg-line-mode-grid { grid-template-columns: 1fr; }
  .phg-line-mode-grid button { min-height: 58px; display: grid; grid-template-columns: 55px 1fr; grid-template-rows: auto auto; column-gap: 7px; text-align: left; }
  .phg-line-mode-grid .phg-line-preview { grid-row: 1 / 3; }
  .phg-stage-card { padding-inline: 5px; }
  .phg-stage-wrap { height: 58dvh; min-height: 390px; }
}

@media (prefers-reduced-motion: reduce) {
  .phg-app *, .phg-app *::before, .phg-app *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
