:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --border: #dbe3ef;
  --text: #1f2937;
  --muted: #64748b;
  --accent: #d31a1a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px;
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 980px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 16px;
}

.page-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row.single {
  flex-direction: column;
}

.compact-row {
  align-items: flex-start;
}

.compact-row select {
  width: min(420px, 100%);
}

.field {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}

label {
  color: #475569;
  font-size: 13px;
}

input[type="text"],
input[type="number"],
select {
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text);
}

input[type="text"] {
  width: 100%;
  min-width: 240px;
  max-width: 540px;
}

input[type="color"] {
  width: 52px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

button,
.home-link {
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  padding: 8px 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #fff5f5;
  border-color: #ef4444;
  color: #b91c1c;
  font-weight: 600;
}

button:hover,
.home-link:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.btn-primary:hover {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.preview-panel {
  display: grid;
  place-items: center;
  min-height: 360px;
}

#sealCanvas {
  border-radius: 12px;
  background-image: repeating-conic-gradient(#e2e8f0 0% 25%, #f8fafc 0% 50%);
  background-size: 16px 16px;
  max-width: 100%;
}

@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-top {
    flex-direction: column;
    align-items: flex-start;
  }
}
