/* style.css */
:root {
  --bg: #f4f5f8;
  --panel: #ffffff;
  --accent: #2f80ed;
  --text-main: #222;
  --text-sub: #666;
  --danger: #e53935;
  --radius-lg: 18px;
  --radius-md: 10px;
  --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.16);
  --shadow-soft: 0 1px 0 rgba(255,255,255,0.9), 0 0 0 1px rgba(148,163,184,0.25);
  --transition-fast: 0.18s ease-out;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* header */
header { padding: 16px 20px 8px; }

.header-inner {
  max-width: 1920px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f80ed, #9b51e0);
  box-shadow: 0 8px 16px rgba(47, 128, 237, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.logo-text-main {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.03em;
}

.logo-text-sub {
  font-size: 11px;
  color: var(--text-sub);
}

.header-tagline {
  font-size: 12px;
  color: var(--text-sub);
  text-align: right;
}

/* hero */
.hero {
  margin-bottom: 16px;
  max-width: 1920px;
  padding: 0 16px 8px;
  margin-inline: auto;
}

.hero-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.hero-sub {
  font-size: 13px;
  color: var(--text-sub);
  max-width: 760px;
  line-height: 1.6;
}

/* main layout */
main {
  flex: 1;
  padding: 0 16px 32px;
}

.layout {
  max-width: 1920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1.6fr);
  gap: 28px;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* card */
.card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.card-caption {
  font-size: 11px;
  color: var(--text-sub);
}

/* preview */
.preview-card {
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1440px) {
  .preview-card {
    min-height: 720px;
  }
}

.preview-viewport {
  flex: 1;
  border-radius: var(--radius-md);
  background: #f0f2f7;
  box-shadow: var(--shadow-soft);
  padding: 10px;
  position: relative;
  overflow: hidden;
  min-height: 420px;
  max-height: calc(100vh - 220px);
}

@media (min-width: 1440px) {
  .preview-viewport {
    min-height: 640px;
    max-height: calc(100vh - 260px);
  }
}

.preview-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(148,163,184,0.25) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148,163,184,0.25) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.preview-inner {
  position: absolute;
  inset: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* sheets */
.sheet-base, .sheet-target {
  position: absolute;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-sizing: border-box;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out, width 0.2s ease-out, height 0.2s ease-out;
}

/* base: colored dashed outline */
.sheet-base {
  background: transparent;
  border: 2px dashed rgba(46, 125, 255, 0.9);
  color: #2f80ed;
  z-index: 1;
}

/* target: black outline + white fill */
.sheet-target {
  background: #ffffff;
  border: 2px solid #111827;
  color: #111827;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
  z-index: 2;
  opacity: 0.98;
}

.sheet-label {
  text-align: center;
  line-height: 1.4;
}

.sheet-label span { display: block; }

.sheet-label .name { font-size: 11px; }

.sheet-label .size {
  font-size: 10px;
  opacity: 0.9;
}

/* legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-sub);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f7f8fb;
  box-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 0 0 1px rgba(148,163,184,0.3);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.legend-color.base {
  border: 2px dashed rgba(46, 125, 255, 0.9);
  background: transparent;
}

.legend-color.target {
  border: 2px solid #111827;
  background: #ffffff;
}

.hint-text {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 6px;
}

/* ads */
.ads-block {
  margin: 12px 0 0;
  border-radius: var(--radius-md);
  background: #f7f8fb;
  box-shadow: var(--shadow-soft);
  padding: 8px;
}

.ads-block-bottom {
  margin-top: 16px;
}

.ads-label {
  font-size: 10px;
  color: var(--text-sub);
  margin-bottom: 4px;
}

/* controls */
.control-card { font-size: 13px; }

.controls-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.control-label {
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: var(--text-sub);
  text-transform: uppercase;
}

select, input[type="number"] {
  border-radius: 8px;
  border: 1px solid #d0d7e2;
  padding: 8px 10px;
  font-size: 13px;
  background: #f9fafb;
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

select:focus, input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(47, 128, 237, 0.3);
  background: #ffffff;
}

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

.unit-label {
  font-size: 11px;
  color: var(--text-sub);
  text-align: right;
  display: block;
  margin-bottom: 2px;
}

.error-text {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
}

/* orientation toggle */
.orientation-toggle {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px;
  background: #f3f4f6;
  box-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 0 0 1px rgba(148,163,184,0.4);
  gap: 4px;
}

.orientation-btn {
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--text-sub);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.orientation-btn.active {
  background: linear-gradient(135deg, #2f80ed, #9b51e0);
  color: #fff;
  box-shadow: 0 4px 10px rgba(47, 128, 237, 0.4);
  transform: translateY(-1px);
}

.orientation-btn:not(.active):hover {
  color: var(--text-main);
}

/* info */
.info-card {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-sub);
}

.info-card strong { color: var(--text-main); }

.info-list {
  margin: 8px 0 0;
  padding-left: 16px;
}

.info-list li { margin-bottom: 4px; }

/* footer */
footer {
  padding: 12px 16px 18px;
  font-size: 11px;
  color: var(--text-sub);
}

.footer-inner {
  max-width: 1920px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.footer-inner a { font-size: 11px; }

/* responsive header */
@media (max-width: 1024px) {
  header { padding-bottom: 16px; }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-tagline { text-align: left; }
}

/* scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}
