:root {
  --navy: #06183f;
  --blue: #0b4d9a;
  --gold: #f8bd19;
  --white: #fff;
  --muted: #6b7280;
  --card: #ffffff;
  --bg: #eef3fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0a1735;
  background:
    radial-gradient(circle at 20% 0%, rgba(19, 91, 180, .18), transparent 35%),
    linear-gradient(135deg, #f6f9ff 0%, var(--bg) 100%);
}

.app {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 20px;
}

.hero {
  color: var(--white);
  border-radius: 22px;
  padding: 28px 32px;
  background:
    radial-gradient(circle at 85% 10%, rgba(248,189,25,.25), transparent 28%),
    linear-gradient(125deg, #03133a, #0a3978 65%, #06183f);
  box-shadow: 0 18px 45px rgba(6, 24, 63, .18);
}

.eyebrow {
  display: inline-block;
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .12em;
  color: var(--gold);
}

h1 {
  margin: 7px 0 5px;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.hero p { margin: 0; opacity: .82; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
  margin-top: 22px;
}

.preview-card, .panel {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 12px 35px rgba(10, 33, 75, .11);
}

.preview-card { padding: 16px; }

.canvas-wrap {
  position: relative;
  width: min(100%, 760px);
  margin: auto;
  overflow: hidden;
  border-radius: 14px;
  background: #09132b;
  line-height: 0;
  user-select: none;
  touch-action: none; -webkit-user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
}

canvas.dragging { cursor: grabbing; }

.empty-state {
  border: 1px solid rgba(255,255,255,.18);
  font: inherit;
  cursor: pointer;
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 4px;
  text-align: center;
  padding: 16px 20px;
  color: white;
  background: rgba(3, 19, 58, .82);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  line-height: 1.3;
  pointer-events: auto;
  z-index: 5;
  touch-action: manipulation;
}

.empty-state span { font-size: .82rem; opacity: .75; }

.panel { padding: 22px; }

.upload-box {
  padding: 18px;
  text-align: center;
  border: 2px dashed #bfd0e8;
  border-radius: 15px;
  background: #f7faff;
}

.upload-box p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .78rem;
}
.top-download {
  width: 100%;
  margin-top: 9px;
}

button {
  border: 0;
  border-radius: 11px;
  padding: 12px 15px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s, filter .15s, opacity .15s;
}

button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.03); }
button:disabled { cursor: not-allowed; opacity: .45; }

.primary {
  width: 100%;
  color: white;
  background: linear-gradient(135deg, #0a62c5, #0b3e89);
}

.controls { margin-top: 23px; }

.controls label {
  display: flex;
  justify-content: space-between;
  margin: 15px 0 7px;
  font-size: .85rem;
  font-weight: 750;
}

.controls output {
  color: var(--blue);
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.hint {
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 13px;
  border-radius: 12px;
  background: #f2f6fc;
  color: #4b5b73;
  font-size: .78rem;
  line-height: 1.45;
}

.hint strong { color: #0b2550; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 9px;
  margin-top: 20px;
}

.secondary { background: #e9eef6; color: #18345e; }
.download { background: linear-gradient(135deg, #f6b900, #e39200); color: #18213a; }

footer {
  text-align: center;
  color: #71809a;
  font-size: .72rem;
  line-height: 1.6;
  padding: 18px 0 4px;
}

footer a {
  color: #0b4d9a;
  text-decoration: none;
  font-weight: 700;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { width: 100%; }
}

@media (max-width: 500px) {
  .app { width: min(100% - 14px, 1180px); padding-top: 10px; }
  .hero { border-radius: 16px; padding: 20px; }
  .preview-card { padding: 8px; }
  .panel { padding: 16px; }
}

.rotate-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.rotate-buttons button {
  padding: 9px 10px;
  font-size: .82rem;
}
