@charset "UTF-8";

:root {
  --primary: #1565c0;
  --primary-hover: #0d47a1;
  --accent: #0ea5e9;
  --bg: #eef3f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --border: #cfd8e3;
  --danger: #b91c1c;
  --success: #047857;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  padding: 18px 16px 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef6ff 0%, var(--bg) 100%);
}

a {
  color: inherit;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
}

.hero {
  margin: 0 0 14px;
  padding: 22px 20px;
  border: 1px solid #d7e6f8;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  text-align: center;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  line-height: 1.25;
  color: #0f3f7a;
}

.lead {
  margin: 0;
  color: #475569;
  line-height: 1.7;
  font-size: 0.96rem;
}

.panel {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.07);
}

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

.field {
  display: grid;
  gap: 8px;
}

label,
.field-title {
  font-weight: 700;
  color: #24364d;
}

input[type="file"],
select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text);
  font: inherit;
}

.file-state {
  min-height: 2.6em;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  word-break: break-all;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.notice {
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  line-height: 1.7;
  font-size: 0.92rem;
}

.notice.warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.notice.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.preview-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.canvas-frame {
  overflow: hidden;
  border: 1px solid #0f172a;
  border-radius: 14px;
  background: #111827;
}

.preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #111827;
}

.controls {
  display: grid;
  gap: 10px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.04s ease, opacity 0.16s ease;
}

.btn:hover,
.download-link:hover {
  background: var(--primary-hover);
}

.btn:active,
.download-link:active {
  transform: translateY(1px);
}

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

.btn.sub {
  background: #64748b;
}

.btn.sub:hover {
  background: #475569;
}

.status-card {
  padding: 13px;
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  background: #f8fafc;
}

.progress-wrap {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d4ed8, #0ea5e9);
  transition: width 0.18s linear;
}

.progress-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  color: #334155;
  font-size: 0.84rem;
}

.download-area {
  margin-top: 12px;
}

.log {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: #0f172a;
  color: #dbeafe;
  line-height: 1.6;
  font-size: 0.83rem;
}

.small-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.app-footer {
  width: min(100%, 980px);
  margin: 16px auto 0;
  min-height: 32px;
  border-top: 1px solid #cfd8e3;
  background: #eef3f8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-footer p {
  margin: 0;
  padding: 6px 10px;
  color: #1d4ed8;
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: center;
}

.app-footer a {
  color: #1d4ed8;
  text-decoration: none;
}

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

.ad-panel {
  width: min(100%, 980px);
  margin: 14px auto 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d7e6f8;
  border-radius: 12px;
  background: #ffffff;
}

.ad-panel[hidden] {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

.ad-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid #d7e6f8;
  background: #f4f8ff;
}

.ad-label {
  color: #4f6f91;
  font-size: 0.72rem;
  line-height: 1;
}

.ad-close-btn {
  margin: 0;
  padding: 3px 8px;
  min-height: 0;
  height: auto;
  border: 0;
  border-radius: 999px;
  background: #1565c0;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.ad-close-btn:hover {
  background: #0d47a1;
}

.ad-body {
  padding: 8px;
  background: #ffffff;
}

@media (max-width: 760px) {
  body {
    padding: 12px 10px 0;
  }

  .grid,
  .option-grid,
  .preview-wrap {
    grid-template-columns: 1fr;
  }

  .progress-info {
    grid-template-columns: 1fr;
  }

  .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn,
  .download-link {
    width: 100%;
  }
}
