Files
occupancy-fitting/web/style.css
T
OpenCode 20567c0781 feat: container packing simulator + Android shell
- web/packing: scan-sweep planner (bottom-up X/Y sweep, all items per cell),
  multi-direction candidates, gap fill, stack/capacity/rigid-body checks,
  theoretical fill bound with red warning, occupancy voxel metrics
- per-item params via right-click menu (upright, stack count, capacity,
  box/voxel fit, mass); simplified left panel
- 3D: pan/zoom/rotate mouse mapping, touch gestures, draggable XYZ compass
- android: offline WebView APK build pipeline (aapt2/javac/d8/apksigner)
- docs: packing preview and mobile screenshots
2026-11-26 15:26:16 +08:00

622 lines
14 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
:root {
--bg: #060a12;
--panel: #0a111e;
--panel-2: #0d1627;
--line: #1b2a42;
--line-soft: #142033;
--text: #e7f1ff;
--muted: #7f95b3;
--faint: #4d6380;
--cyan: #56e1ff;
--cyan-dim: #2b8ca8;
--amber: #ffb45a;
--green: #6df5b1;
--red: #ff7a7a;
--violet: #b991ff;
--mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
--sans: "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
"Microsoft YaHei", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body {
height: 100%;
margin: 0;
background: var(--bg);
color: var(--text);
font-family: var(--sans);
-webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }
#app {
display: grid;
grid-template-columns: 392px minmax(0, 1fr);
height: 100vh;
width: 100vw;
}
/* ------------------------------------------------------------------ panel */
#panel {
position: relative;
z-index: 2;
overflow-y: auto;
overflow-x: hidden;
padding: 22px 22px 18px;
background:
radial-gradient(1200px 400px at -20% -10%, rgba(86, 225, 255, 0.08), transparent 55%),
linear-gradient(180deg, #0b1424 0%, var(--panel) 35%, #080e19 100%);
border-right: 1px solid var(--line);
scrollbar-width: thin;
scrollbar-color: #20344f transparent;
}
#panel::-webkit-scrollbar { width: 8px; }
#panel::-webkit-scrollbar-thumb { background: #20344f; border-radius: 4px; }
#panel::-webkit-scrollbar-track { background: transparent; }
.brand { padding-bottom: 18px; }
.eyebrow {
display: flex;
align-items: center;
gap: 8px;
color: var(--muted);
font-size: 10px;
letter-spacing: 0.18em;
font-weight: 600;
text-transform: uppercase;
}
.eyebrow .dot {
width: 6px; height: 6px; border-radius: 50%;
background: var(--green);
box-shadow: 0 0 10px var(--green);
}
h1 {
margin: 12px 0 10px;
font-family: "Arial Narrow", "Helvetica Neue", var(--sans);
font-size: 42px;
line-height: 0.92;
letter-spacing: 0.02em;
font-weight: 800;
}
h1 span { color: var(--cyan); }
.sub {
margin: 0;
color: var(--muted);
font-size: 12px;
line-height: 1.6;
}
.block {
padding: 16px 0;
border-top: 1px solid var(--line-soft);
}
.block-title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 11px;
letter-spacing: 0.13em;
text-transform: uppercase;
color: var(--muted);
font-weight: 700;
margin-bottom: 12px;
}
.block-title .live {
font-family: var(--mono);
font-size: 9px;
color: var(--green);
border: 1px solid rgba(109, 245, 177, 0.3);
border-radius: 20px;
padding: 2px 7px;
letter-spacing: 0.12em;
}
.block-title .sub2 {
font-size: 9px;
color: var(--faint);
letter-spacing: 0.05em;
text-transform: none;
}
/* ---------------------------------------------------------------- controls */
.label-row {
display: flex;
align-items: baseline;
justify-content: space-between;
margin-bottom: 8px;
}
.label-row.second { margin-top: 18px; }
.label-row label { color: var(--muted); font-size: 12px; }
.label-row output {
font-family: var(--mono);
font-size: 20px;
color: var(--cyan);
font-weight: 600;
letter-spacing: -0.02em;
}
input[type="range"] {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 4px;
border-radius: 4px;
background: linear-gradient(90deg, var(--cyan-dim), #1d3550);
outline: none;
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 15px; height: 15px;
border-radius: 50%;
background: var(--cyan);
border: 3px solid #06101d;
box-shadow: 0 0 0 1px var(--cyan), 0 0 14px rgba(86, 225, 255, 0.55);
}
input[type="range"]::-moz-range-thumb {
width: 15px; height: 15px;
border-radius: 50%;
background: var(--cyan);
border: 3px solid #06101d;
box-shadow: 0 0 0 1px var(--cyan);
}
input[type="range"]::-moz-range-track {
height: 4px; border-radius: 4px;
background: linear-gradient(90deg, var(--cyan-dim), #1d3550);
}
.hint {
margin-top: 8px;
color: var(--faint);
font-size: 10.5px;
line-height: 1.5;
}
.button-row { display: flex; gap: 8px; margin-top: 14px; }
button {
font-family: var(--sans);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
border-radius: 7px;
padding: 9px 13px;
cursor: pointer;
border: 1px solid var(--line);
background: #0d1728;
color: var(--text);
transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
button:hover { border-color: var(--cyan-dim); }
button.primary {
flex: 1;
background: linear-gradient(180deg, rgba(86, 225, 255, 0.16), rgba(86, 225, 255, 0.06));
border-color: rgba(86, 225, 255, 0.4);
color: var(--cyan);
}
button.primary:hover { background: rgba(86, 225, 255, 0.18); }
button.ghost { flex: 1; color: var(--muted); }
/* ------------------------------------------------------------------- stats */
.metric {
display: flex;
align-items: baseline;
gap: 6px;
margin: 6px 0;
}
.metric .k {
flex: 1;
color: var(--muted);
font-size: 11px;
}
.metric .v {
font-family: var(--mono);
font-size: 18px;
font-weight: 600;
color: var(--text);
letter-spacing: -0.02em;
}
.metric.big .v { font-size: 27px; color: var(--cyan); }
.metric.big:nth-of-type(2) .v { color: var(--amber); }
.metric .v.small { font-size: 14px; }
.metric .u { color: var(--faint); font-size: 10px; font-family: var(--mono); }
.metric.big:nth-of-type(2) .v.neg { color: var(--red); }
.metric.big:nth-of-type(2) .v.pos { color: var(--green); }
.grid2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 12px;
}
.mini {
background: rgba(12, 23, 40, 0.75);
border: 1px solid var(--line-soft);
border-radius: 7px;
padding: 8px 9px;
}
.mini .k {
display: block;
color: var(--faint);
font-size: 9.5px;
letter-spacing: 0.04em;
margin-bottom: 3px;
}
.mini b {
font-family: var(--mono);
font-size: 14px;
font-weight: 600;
color: var(--text);
}
.divider {
height: 1px;
background: var(--line-soft);
margin: 13px 0 10px;
}
.segmented {
display: flex;
gap: 0;
margin-top: 14px;
border: 1px solid var(--line);
border-radius: 7px;
overflow: hidden;
}
.segmented button {
flex: 1;
border: 0;
border-radius: 0;
background: transparent;
color: var(--faint);
padding: 8px 6px;
font-size: 10px;
}
.segmented button.active {
background: rgba(255, 180, 90, 0.12);
color: var(--amber);
box-shadow: inset 0 -2px 0 var(--amber);
}
.ref-row {
display: flex;
align-items: baseline;
gap: 6px;
font-size: 10.5px;
color: var(--muted);
margin: 5px 0;
}
.ref-row b {
margin-left: auto;
font-family: var(--mono);
font-weight: 500;
color: #b9cce4;
}
.ref-row span:last-child { color: var(--faint); font-family: var(--mono); font-size: 9px; }
.ref-note {
margin-top: 9px;
color: var(--faint);
font-size: 10px;
line-height: 1.55;
}
/* ------------------------------------------------------------------- chart */
.chart-block { padding-bottom: 8px; }
.chart-wrap { position: relative; width: 100%; height: 158px; }
#chart { width: 100%; height: 100%; display: block; cursor: crosshair; }
.chart-legend {
display: flex;
justify-content: flex-end;
gap: 12px;
font-family: var(--mono);
font-size: 9px;
color: var(--faint);
padding-top: 2px;
}
.chart-legend .pos { color: var(--cyan-dim); }
.chart-legend .neg { color: #b06a4a; }
.chart-tip {
position: fixed;
z-index: 20;
pointer-events: none;
padding: 5px 8px;
border-radius: 5px;
border: 1px solid var(--line);
background: #0b1525;
color: var(--text);
font-family: var(--mono);
font-size: 10px;
opacity: 0;
transition: opacity 80ms ease;
white-space: nowrap;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
/* ----------------------------------------------------------------- toggles */
.toggles {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px 10px;
}
.switch {
display: flex;
align-items: center;
gap: 7px;
color: var(--muted);
font-size: 10.5px;
cursor: pointer;
user-select: none;
}
.switch input {
appearance: none;
-webkit-appearance: none;
width: 26px; height: 14px;
border-radius: 10px;
background: #16253b;
border: 1px solid #233a58;
position: relative;
cursor: pointer;
transition: background 120ms ease;
flex: none;
}
.switch input::after {
content: "";
position: absolute;
width: 8px; height: 8px;
top: 2px; left: 2px;
border-radius: 50%;
background: #7085a0;
transition: transform 120ms ease, background 120ms ease;
}
.switch input:checked { background: rgba(86, 225, 255, 0.2); border-color: rgba(86, 225, 255, 0.45); }
.switch input:checked::after { transform: translateX(12px); background: var(--cyan); }
/* ------------------------------------------------------------------ method */
.method {
border-top: 1px solid var(--line-soft);
padding: 14px 0 8px;
color: var(--muted);
font-size: 10.5px;
line-height: 1.65;
}
.method summary {
color: var(--faint);
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
cursor: pointer;
outline: none;
list-style: none;
}
.method summary::-webkit-details-marker { display: none; }
.method summary::before { content: "+ "; color: var(--cyan-dim); }
.method[open] summary::before { content: "- "; }
.method p { margin: 10px 0 0; }
.method .formula {
font-family: var(--mono);
font-size: 10px;
color: #a9c1dc;
background: #08101d;
border: 1px solid var(--line-soft);
border-radius: 6px;
padding: 9px 10px;
line-height: 1.8;
}
.foot {
display: flex;
justify-content: space-between;
gap: 8px;
padding-top: 13px;
border-top: 1px solid var(--line-soft);
color: #41546d;
font-size: 8.5px;
font-family: var(--mono);
line-height: 1.5;
}
/* ---------------------------------------------------------------- viewport */
#viewport {
position: relative;
min-width: 0;
min-height: 0;
overflow: hidden;
background:
radial-gradient(ellipse at 50% 38%, rgba(31, 67, 105, 0.24), transparent 58%),
linear-gradient(180deg, #07111f 0%, #05090f 70%);
}
#viewport canvas { position: absolute; inset: 0; display: block; }
.viewport-toolbar {
position: absolute;
z-index: 5;
top: 18px;
left: 20px;
right: 20px;
display: flex;
align-items: center;
justify-content: space-between;
pointer-events: none;
}
.cam-buttons {
display: flex;
gap: 4px;
padding: 4px;
border-radius: 9px;
border: 1px solid rgba(45, 70, 100, 0.6);
background: rgba(7, 14, 26, 0.72);
backdrop-filter: blur(10px);
pointer-events: auto;
}
.cam-buttons button {
border: 0;
background: transparent;
color: var(--faint);
padding: 6px 10px;
font-size: 10px;
}
.cam-buttons button.active { color: var(--cyan); background: rgba(86, 225, 255, 0.1); }
.cam-buttons button:hover { color: var(--text); }
.legend {
display: flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
border-radius: 8px;
border: 1px solid rgba(45, 70, 100, 0.55);
background: rgba(7, 14, 26, 0.65);
backdrop-filter: blur(10px);
pointer-events: auto;
}
.legend-label, .legend-ends { font-size: 8.5px; color: var(--faint); font-family: var(--mono); }
.legend-bar {
width: 74px; height: 6px; border-radius: 4px;
background: linear-gradient(90deg, #2f9dff, #5dffd0 35%, #ffe36b 65%, #ff8c42);
box-shadow: 0 0 12px rgba(86, 225, 255, 0.25);
}
.viewport-hint {
position: absolute;
z-index: 4;
left: 22px;
bottom: 16px;
color: #3d516b;
font-size: 9.5px;
letter-spacing: 0.04em;
pointer-events: none;
}
.loading {
position: absolute;
z-index: 10;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
color: var(--cyan-dim);
font-family: var(--mono);
font-size: 12px;
background: rgba(5, 9, 15, 0.7);
transition: opacity 250ms ease;
}
.loading.hidden { opacity: 0; pointer-events: none; }
.error {
position: absolute;
z-index: 11;
inset: 28px;
display: flex;
align-items: center;
justify-content: center;
padding: 30px;
border: 1px solid rgba(255, 122, 122, 0.35);
border-radius: 12px;
background: rgba(30, 8, 12, 0.9);
color: #ffb0b0;
font-size: 13px;
line-height: 1.7;
text-align: center;
}
/* ---------------------------------------------------------------- responsive */
@media (max-width: 920px) {
body { overflow: auto; }
#app {
grid-template-columns: 1fr;
grid-template-rows: auto minmax(420px, 58vh);
height: auto;
min-height: 100vh;
}
#panel {
max-height: none;
border-right: 0;
border-bottom: 1px solid var(--line);
padding: 18px 16px;
}
h1 { font-size: 34px; }
#viewport { min-height: 58vh; }
.viewport-toolbar { top: 12px; left: 12px; right: 12px; }
.legend { display: none; }
}
/* The [hidden] UA rule is overridden by .error { display:flex }; make it explicit. */
.error[hidden] { display: none; }
.method .source {
color: #526987;
font-size: 9.5px;
}
.method .source a {
color: var(--cyan-dim);
text-decoration: none;
border-bottom: 1px dotted rgba(86, 225, 255, 0.25);
}
.method .source a:hover { color: var(--cyan); }
/* envelope comparison (cube / rotated cube / upright cuboid) */
.env-compare {
margin-top: 9px;
padding: 7px 9px;
border: 1px solid var(--line-soft);
border-radius: 6px;
background: rgba(8, 17, 30, 0.75);
font-family: var(--mono);
font-size: 9px;
line-height: 1.55;
color: var(--faint);
}
.env-compare div {
display: flex;
align-items: baseline;
gap: 6px;
}
.env-compare span { flex: 1; }
.env-compare b { font-weight: 500; color: #b9cce4; }
.env-compare em {
font-style: normal;
color: var(--faint);
width: 52px;
text-align: right;
}
.env-compare div.on span,
.env-compare div.on b,
.env-compare div.on em { color: var(--green); }
/* ------------------------------------------------------------------ page tabs */
.page-tabs {
display: flex;
gap: 5px;
margin: 0 0 16px;
}
.page-tabs a {
flex: 1;
padding: 7px 8px;
text-align: center;
font-size: 10.5px;
letter-spacing: 0.08em;
color: var(--muted);
text-decoration: none;
border: 1px solid var(--line);
border-radius: 6px;
background: rgba(8, 15, 26, 0.6);
transition: color 0.15s, border-color 0.15s;
}
.page-tabs a:hover {
color: var(--text);
border-color: var(--cyan-dim);
}
.page-tabs a.active {
color: #04121a;
font-weight: 700;
border-color: transparent;
background: linear-gradient(180deg, #8beaff, #4fd3f2);
}