Files
css-matrix-calc/style.css
T

355 lines
6.0 KiB
CSS

:root {
--bg: #0d1117;
--panel: #161b22;
--border: #30363d;
--text: #c9d1d9;
--heading: #e6edf3;
--accent: #58a6ff;
--accent-dim: rgba(88, 166, 255, 0.12);
--input-bg: #0d1117;
--btn-bg: #238636;
--btn-hover: #2ea043;
--widget-bg: #1a1a3e;
--widget-grid: rgba(88, 166, 255, 0.15);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
}
header {
padding: 16px 24px;
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
header h1 {
font-size: 18px;
color: var(--heading);
font-weight: 600;
}
header p {
font-size: 13px;
color: #8b949e;
margin-top: 4px;
}
.header-left {
min-width: 0;
}
.mode-toggle {
display: flex;
gap: 0;
border: 1px solid var(--border);
border-radius: 6px;
overflow: hidden;
flex-shrink: 0;
}
.mode-btn {
padding: 6px 18px;
border: none;
background: var(--panel);
color: #8b949e;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.mode-btn:hover {
color: var(--text);
}
.mode-btn.active {
background: var(--accent);
color: #fff;
}
.mode-hint {
font-size: 14px;
color: var(--accent);
font-weight: 500;
margin-right: 8px;
white-space: nowrap;
}
main {
display: grid;
grid-template-columns: 1fr 340px;
gap: 16px;
padding: 16px 24px;
margin: 0 auto;
}
.panel {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
padding: 16px;
}
.panel h2 {
font-size: 13px;
font-weight: 600;
color: #8b949e;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 12px;
}
.left-col {
display: flex;
flex-direction: column;
gap: 16px;
}
.right-col {
display: flex;
flex-direction: column;
gap: 16px;
}
#svg {
width: 100%;
display: block;
border-radius: 4px;
background: #0a0e14;
user-select: none;
-webkit-user-select: none;
touch-action: none;
}
.corner-circle {
cursor: grab;
filter: drop-shadow(0 0 4px rgba(88, 166, 255, 0.5));
transition: r 0.1s;
}
.corner-circle:hover {
r: 14;
}
.corner-circle.dragging {
cursor: grabbing;
r: 14;
}
.corner-label {
font-size: 22px;
fill: var(--text);
font-family: monospace;
pointer-events: none;
}
.corner-coord {
font-size: 18px;
fill: #8b949e;
font-family: monospace;
pointer-events: none;
}
.field-row {
display: flex;
gap: 12px;
align-items: center;
}
.field-row label {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
color: #8b949e;
flex: 1;
}
.field-row label span {
min-width: 14px;
}
.field-row input {
width: 100%;
padding: 6px 8px;
background: var(--input-bg);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--heading);
font-size: 14px;
font-family: monospace;
outline: none;
}
.field-row input:focus {
border-color: var(--accent);
}
.corner-inputs {
display: flex;
flex-direction: column;
gap: 8px;
}
.corner-input-row {
display: flex;
align-items: center;
gap: 8px;
}
.corner-input-row .label {
font-size: 13px;
font-weight: 600;
color: var(--accent);
min-width: 28px;
font-family: monospace;
}
.corner-input-row label {
display: flex;
align-items: center;
gap: 4px;
font-size: 13px;
color: #8b949e;
flex: 1;
}
.corner-input-row label span {
min-width: 12px;
}
.corner-input-row input {
width: 100%;
padding: 5px 6px;
background: var(--input-bg);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--heading);
font-size: 13px;
font-family: monospace;
outline: none;
}
.corner-input-row input:focus {
border-color: var(--accent);
}
#cssOutput {
width: 100%;
min-height: 80px;
padding: 10px;
background: var(--input-bg);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--accent);
font-size: 12px;
font-family: "Cascadia Code", "Fira Code", monospace;
line-height: 1.6;
resize: vertical;
outline: none;
}
.btn-row {
display: flex;
gap: 8px;
margin-top: 8px;
}
.btn {
padding: 6px 14px;
border: none;
border-radius: 4px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
}
.btn-copy {
background: var(--btn-bg);
color: white;
}
.btn-copy:hover {
background: var(--btn-hover);
}
.btn-reset {
background: var(--border);
color: var(--text);
}
.btn-reset:hover {
background: #484f58;
}
#fieldContainer {
width: 100%;
overflow: hidden;
border-radius: 4px;
background: #080b10;
border: 2px solid #1a1f2a;
position: relative;
}
#field {
position: relative;
transform-origin: 0 0;
background: #0c1018;
}
#widget {
position: absolute;
top: 0;
left: 0;
transform-origin: 0 0;
background-color: var(--widget-bg);
background-image:
linear-gradient(45deg, var(--widget-grid) 25%, transparent 25%, transparent 75%, var(--widget-grid) 75%),
linear-gradient(45deg, var(--widget-grid) 25%, transparent 25%, transparent 75%, var(--widget-grid) 75%);
background-size: 30px 30px;
background-position:
0 0,
15px 15px;
border: 2px solid var(--accent);
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
#widget span {
color: rgba(255, 255, 255, 0.7);
font-size: 14px;
font-weight: 600;
letter-spacing: 2px;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
pointer-events: none;
}
.error-msg {
color: #f85149;
font-size: 12px;
font-style: italic;
}
body.mode-edit .left-col .panel:first-child,
body.mode-edit .right-col {
display: flex;
}
body.mode-edit .left-col .panel:last-child {
display: none;
}
body.mode-preview .left-col .panel:first-child,
body.mode-preview .right-col {
display: none;
}
body.mode-preview main {
display: flex;
justify-content: center;
align-items: flex-start;
}
body.mode-preview .left-col {
max-width: 900px;
width: 100%;
}
@media (max-width: 900px) {
main {
grid-template-columns: 1fr;
}
}