:root {
  --bg: #e8f2ff;
  --panel: rgba(247, 251, 255, 0.9);
  --ink: #16324c;
  --muted: #52708c;
  --line: #b6d0ea;
  --accent: #2274d6;
  --danger: #8b2e2e;
  --accent-strong: #185cb0;
  --shadow: 0 18px 36px rgba(32, 82, 145, 0.14);
}

* { box-sizing: border-box; }

html.unsupported-mobile,
html.unsupported-mobile body {
  width: 100%;
  min-height: 100%;
}

html.unsupported-mobile body {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #7c7c7c;
  color: #ffffff;
  font-family: sans-serif;
}

html.unsupported-mobile body > * {
  display: none !important;
}

#mobileUnsupportedMessage {
  display: none;
}

html.unsupported-mobile #mobileUnsupportedMessage {
  display: block !important;
  padding: 24px;
  text-align: center;
  font-size: 24px;
  line-height: 1.5;
}

body {
  margin: 0;
  font-family: "Yu Gothic UI", "Hiragino Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(122, 180, 255, 0.34), transparent 30%),
    radial-gradient(circle at bottom right, rgba(143, 209, 255, 0.28), transparent 26%),
    linear-gradient(180deg, #f5fbff 0%, #dcecff 100%);
}

button, input, select { font: inherit; }

.shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 24px 88px;
}

.hero, .panel, .statusbar {
  background: var(--panel);
  border: 1px solid rgba(82, 130, 182, 0.2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 28px;
  align-items: flex-start;
}

.hero-main {
  flex: 1;
  min-width: 0;
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  box-shadow: 0 10px 18px rgba(34, 116, 214, 0.2);
}

.hero-side {
  display: flex;
  min-width: min(720px, 100%);
  justify-content: flex-end;
}

.hero-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
  align-items: end;
}

.hero-toolbar label:not(.button) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
}

.hero-toolbar label:not(.button) span {
  font-size: 13px;
  font-weight: 700;
}

.hero-toolbar select,
.hero-toolbar .button,
.hero-toolbar button {
  min-height: 48px;
}

.hero-toolbar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 14px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1, .panel h2, .panel h3 { margin: 0; }

.hero-copy {
  margin: 12px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #edf6ff);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(52, 117, 182, 0.08);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button.primary {
  background: linear-gradient(135deg, #4f9cff, var(--accent-strong));
  color: #fff;
  border-color: transparent;
}

.button.danger {
  color: #fff;
  background: linear-gradient(135deg, #cf5f5f, var(--danger));
  border-color: transparent;
}

.button input { display: none; }

.layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.panel {
  padding: 22px;
  border-radius: 24px;
}

.input-panel, .assignment-panel, .export-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.export-panel { grid-column: 1 / -1; }

.drop-zone {
  border: 2px dashed #8ebae6;
  border-radius: 22px;
  padding: 32px 20px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(225, 239, 255, 0.78)),
    repeating-linear-gradient(45deg, rgba(34, 116, 214, 0.05) 0 12px, transparent 12px 24px);
  color: var(--muted);
}

.drop-zone.is-active { border-color: var(--accent); }

.control-grid, .font-meta, .export-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.control-grid label, .font-meta label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

.check { justify-content: flex-end; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.preview-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(119, 166, 214, 0.18);
}

.preview-card canvas {
  width: 100%;
  aspect-ratio: 1;
  margin-top: 12px;
  border-radius: 16px;
  background:
    linear-gradient(45deg, #e4e0da 25%, transparent 25%),
    linear-gradient(-45deg, #e4e0da 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e4e0da 75%),
    linear-gradient(-45deg, transparent 75%, #e4e0da 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.assignment-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.assignment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
}

.char-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  cursor: pointer;
}

.char-slot.is-active { border-color: var(--accent); }

.char-slot.is-filled {
  background: linear-gradient(180deg, rgba(244, 250, 255, 0.98), rgba(214, 234, 255, 0.96));
}

.char-slot canvas {
  width: 38px;
  height: 38px;
}

.slot-label {
  font-weight: 700;
}

.slot-code {
  color: var(--muted);
  font-size: 11px;
  word-break: break-word;
  text-align: center;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 18px;
}

.note { margin: 0; color: var(--muted); }

.corner-logo {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: rgba(246, 251, 255, 0.82);
  box-shadow: 0 12px 24px rgba(34, 116, 214, 0.16);
  backdrop-filter: blur(12px);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.corner-logo img {
  width: 40px;
  height: 40px;
}

.corner-logo:hover {
  animation: logo-hop 420ms ease;
  box-shadow: 0 16px 28px rgba(34, 116, 214, 0.24);
}

@keyframes logo-hop {
  0% { transform: translateY(0); }
  35% { transform: translateY(-7px) scale(1.03); }
  65% { transform: translateY(1px) scale(0.99); }
  100% { transform: translateY(0); }
}

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .hero {
    flex-direction: column;
  }
  .hero-side {
    width: 100%;
  }
  .hero-toolbar {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 720px) {
  .assignment-header, .statusbar { flex-direction: column; }
  .preview-grid { grid-template-columns: 1fr; }
  .hero-toolbar {
    grid-template-columns: 1fr;
  }
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }
}
