:root {
  --bg-1: #f7f1e1;
  --bg-2: #f0e6ff;
  --ink: #1b1a1a;
  --muted: #4a4a4a;
  --accent: #ff6b4a;
  --accent-2: #2f80ed;
  --card: #fffaf2;
  --shadow: 0 20px 50px rgba(27, 26, 26, 0.15);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Futura", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 10% 10%, rgba(255, 235, 210, 0.9), transparent 60%),
    radial-gradient(900px 600px at 90% 0%, rgba(197, 227, 255, 0.9), transparent 55%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 380px;
  height: 380px;
  border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
  filter: blur(0);
  opacity: 0.2;
  z-index: 0;
}

body::before {
  top: -120px;
  left: -140px;
  background: #ffe1c7;
  transform: rotate(12deg);
}

body::after {
  bottom: -160px;
  right: -140px;
  background: #cfe7ff;
  transform: rotate(-18deg);
}

main {
  position: relative;
  z-index: 1;
  padding: 40px 24px 64px;
  max-width: 1100px;
  margin: 0 auto;
  animation: fadeUp 0.8s ease;
  flex: 1;
}

body.page-inner main {
  max-width: 1280px;
  padding: 36px 32px 64px;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 0;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #ffb45c);
  display: grid;
  place-items: center;
  color: #fffaf2;
  font-size: 20px;
  box-shadow: 0 10px 30px rgba(255, 107, 74, 0.35);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(27, 26, 26, 0.08);
  transition: all 0.2s ease;
  font-size: 14px;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent);
  color: #fffaf2;
  border-color: transparent;
  transform: translateY(-1px);
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
  align-items: center;
  padding: 40px 0 20px;
}

.hero h1 {
  font-family: "DM Serif Display", "Palatino Linotype", "Book Antiqua", serif;
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  margin: 0 0 16px;
  letter-spacing: 0.02em;
}

.hero p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(27, 26, 26, 0.06);
}

.hero-card h3 {
  margin-top: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  border: none;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fffaf2;
  box-shadow: 0 12px 24px rgba(255, 107, 74, 0.35);
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(27, 26, 26, 0.1);
}

.btn:hover {
  transform: translateY(-2px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 20px;
  border: 1px solid rgba(27, 26, 26, 0.08);
  box-shadow: 0 12px 30px rgba(27, 26, 26, 0.08);
}

.card h4 {
  margin: 0 0 8px;
}

.section-title {
  font-size: 1.4rem;
  margin: 30px 0 12px;
}

.disclaimer {
  background: rgba(255, 238, 208, 0.85);
  border-left: 4px solid var(--accent);
  padding: 14px 16px;
  border-radius: 12px;
  color: #5a3a2a;
  margin-top: 18px;
  font-size: 0.95rem;
}

.panel {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(27, 26, 26, 0.08);
  box-shadow: var(--shadow);
}

.canvas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.canvas-wrap {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(27, 26, 26, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

canvas,
img.preview {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  border: 1px solid rgba(27, 26, 26, 0.1);
}

label {
  font-weight: 600;
}

select,
input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(27, 26, 26, 0.2);
  font-family: inherit;
  font-size: 1rem;
}

.test-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(27, 26, 26, 0.08);
}

.test-item canvas {
  max-width: 240px;
}

.test-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.result {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(207, 231, 255, 0.7);
  color: #234b7a;
  display: none;
}

.result.show {
  display: block;
}

.small {
  font-size: 0.9rem;
  color: var(--muted);
}

footer {
  text-align: center;
  padding: 30px 20px calc(60px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: auto;
}

.select {
  position: relative;
  width: 100%;
}

.select select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.select-trigger {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(27, 26, 26, 0.2);
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select-trigger::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateY(-50%) rotate(45deg);
}

.select.open .select-trigger {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(255, 107, 74, 0.2);
}

.select-options {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px;
  position: absolute;
  width: 100%;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(27, 26, 26, 0.15);
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow: auto;
  display: none;
  z-index: 10;
}

.select.open .select-options {
  display: grid;
  gap: 6px;
}

.select-option {
  border: none;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

.select-option:hover {
  background: rgba(255, 107, 74, 0.15);
  transform: translateX(2px);
}

.select-option.active {
  background: rgba(47, 128, 237, 0.15);
  color: #1a3d6f;
  font-weight: 600;
}

.file-input {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.file-input input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.file-btn {
  border: none;
  background: var(--accent-2);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 24px rgba(47, 128, 237, 0.3);
}

.file-btn:hover {
  transform: translateY(-1px);
}

.file-name {
  background: rgba(255, 255, 255, 0.8);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(27, 26, 26, 0.1);
  color: var(--muted);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    padding-top: 20px;
  }

  body.page-inner main {
    padding: 28px 18px 56px;
  }

  .file-input {
    grid-template-columns: 1fr;
  }

  .button-row .btn {
    width: 100%;
  }
}

@media (min-width: 1100px) {
  body.page-inner .test-row {
    grid-template-columns: repeat(3, minmax(240px, 1fr));
  }

  body.page-inner .canvas-grid {
    grid-template-columns: repeat(2, minmax(420px, 1fr));
  }

  body.page-inner .panel {
    padding: 28px 32px;
  }
}
