:root {
  --bg: #070b1d;
  --panel: rgba(10, 18, 44, 0.95);
  --line: rgba(132, 171, 255, 0.35);
  --text: #e9f4ff;
  --cyan: #76f5ff;
  --mint: #96ffc1;
  --amber: #ffd889;
  --magenta: #ff87d2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% -8%, #38307a 0%, transparent 45%),
    radial-gradient(circle at 88% 118%, #0e4f77 0%, transparent 45%),
    var(--bg);
}

.panel {
  width: min(1080px, 100%);
  border: 2px solid #345694;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(8, 14, 38, 0.97), rgba(7, 11, 30, 0.99));
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(118, 245, 255, 0.15);
  padding: 14px;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--amber);
  font-size: 0.77rem;
}

h1 {
  margin: 6px 0 0;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(118, 245, 255, 0.4);
}

.subtitle {
  margin: 8px 0 0;
  color: #b8caef;
}

.hud {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hud div {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(11, 20, 52, 0.88);
  text-align: center;
  padding: 8px;
}

.hud span {
  display: block;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.55px;
  color: #9cb3e6;
}

.hud strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

.controls {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

button,
select {
  border: 0;
  font: inherit;
  color: inherit;
}

button {
  padding: 9px 12px;
  background: rgba(19, 31, 69, 0.93);
  color: #e5efff;
  font-weight: 700;
  letter-spacing: 0.35px;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }

.group button {
  border-radius: 0;
  border-right: 1px solid rgba(130, 162, 237, 0.33);
}

.group button:last-child { border-right: 0; }

button.active {
  background: linear-gradient(180deg, #80ffe3, #57e9c1);
  color: #05342d;
}

.stampBtn.active {
  background: linear-gradient(180deg, #ffd889, #ffc154);
  color: #3f2800;
}

.picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  height: 38px;
  font-weight: 700;
  color: #cbdcff;
}

select {
  background: transparent;
  color: #f0f7ff;
  height: 30px;
  outline: none;
}

option {
  color: #081024;
}

.primary {
  background: linear-gradient(180deg, #8effd2, #58e5bc);
  color: #053329;
}

.ghost {
  border: 1px solid rgba(138, 171, 246, 0.4);
}

.canvasWrap {
  margin-top: 12px;
  border: 1px solid rgba(135, 170, 244, 0.42);
  border-radius: 12px;
  overflow: hidden;
  background: #040916;
  position: relative;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
}

.canvasWrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03) 0,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(0, 0, 0, 0.09) 2px,
    rgba(0, 0, 0, 0.09) 4px
  );
}

.hint {
  margin: 10px 2px 0;
  color: #c6d7ff;
  min-height: 1.3em;
}

@media (max-width: 760px) {
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body { padding: 8px; }
  button { padding: 8px 10px; }
}
