/* Modern Clean Aesthetic & Responsive Layout */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-hover: #15803d;
  --dark: #0f172a;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --radius: 10px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--dark);
  text-decoration: none;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.logo-accent {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
}

.nav-link {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
}

@media (max-width: 820px) {
  .nav-links {
    display: none;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.55rem 1.15rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-success {
  background-color: var(--success);
  color: #fff;
}
.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-outline:hover {
  background: #f1f5f9;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: var(--text);
  background: #f1f5f9;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 2.25rem 0 1.5rem;
}

.hero-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: 2.35rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.85rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 760px;
  margin: 0 auto 1.75rem;
}

/* Quick Toolbar */
.quick-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.tool-group select {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  font-family: inherit;
  font-size: 0.9rem;
  background-color: #fff;
  cursor: pointer;
  outline: none;
}
.tool-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tool-checkbox {
  user-select: none;
  font-size: 0.85rem;
  color: #334155;
  cursor: pointer;
}
.tool-checkbox input {
  margin-right: 0.35rem;
  cursor: pointer;
}

/* Printable Section & Live Canvas */
.printable-section {
  margin: 2rem 0;
}

.print-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.live-dot {
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.print-alert-badge {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

/* Physical Paper Sheet Mockup */
.print-sheet-container {
  background: #ffffff;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow-x: auto;
  padding: 20px;
}

.sheet-letter {
  max-width: 1020px;
}

.sheet-a4 {
  max-width: 1080px;
}

#ruler-sheet-content {
  width: 100%;
}

/* Themes */
.theme-standard svg .ruler-bg { fill: #ffffff; }
.theme-standard svg .ruler-border { stroke: #000000; }
.theme-standard svg .ruler-text { fill: #000000; }
.theme-standard svg .ruler-tick { stroke: #000000; }

.theme-accent svg .ruler-bg { fill: #f0f7ff; }
.theme-accent svg .ruler-border { stroke: #1e3a8a; }
.theme-accent svg .ruler-text { fill: #1e3a8a; }
.theme-accent svg .ruler-tick { stroke: #1e3a8a; }

.theme-kids svg .ruler-bg { fill: #fffdf5; }
.theme-kids svg .ruler-border { stroke: #d97706; }
.theme-kids svg .ruler-text { fill: #b45309; }
.theme-kids svg .ruler-tick { stroke: #b45309; }

/* Screen Ruler Card */
.screen-ruler-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 1.75rem;
  margin: 2.5rem 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark);
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.calibration-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-pill {
  font-size: 0.75rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Calibration Drawer */
.calibration-box {
  background: #f8fafc;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.calibration-box.hidden {
  display: none;
}

.cal-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.cal-tab {
  background: #e2e8f0;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: #475569;
  transition: all 0.15s ease;
}

.cal-tab.active {
  background: var(--primary);
  color: #fff;
}

.cal-method-view.hidden {
  display: none;
}

.cal-guide {
  font-size: 0.85rem;
  color: #334155;
  margin-bottom: 0.85rem;
}

.cal-card-visual-wrapper,
.cal-coin-visual-wrapper {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0;
}

.cal-card-box {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  border-radius: 10px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  box-shadow: 0 4px 10px rgba(30, 58, 138, 0.3);
  position: relative;
  width: 324px;
  height: 204px;
  box-sizing: border-box;
}

.cal-chip {
  width: 38px;
  height: 28px;
  background: #fbbf24;
  border-radius: 4px;
  border: 1px solid #d97706;
}

.cal-card-label {
  font-weight: 700;
  font-size: 0.9rem;
}

.cal-card-dim {
  font-size: 0.75rem;
  opacity: 0.8;
  font-family: 'JetBrains Mono', monospace;
}

/* Coin View */
.cal-coin-box {
  background: radial-gradient(circle, #f59e0b, #b45309);
  border: 2px solid #78350f;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(180, 83, 9, 0.3);
  width: 92px;
  height: 92px;
}

/* Screen Presets */
.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.cal-slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.cal-slider-row input[type="range"] {
  flex: 1;
  min-width: 150px;
}

#ppi-slider-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 70px;
}

/* Screen Ruler Surface */
.screen-ruler-wrapper {
  margin-top: 1rem;
}

.screen-ruler-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.screen-ruler-unit-tabs {
  display: flex;
  gap: 0.5rem;
}

.unit-tab {
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.unit-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.ruler-measurement-display {
  font-size: 0.95rem;
  color: #334155;
  background: #f8fafc;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.ruler-measurement-display strong {
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
}

.interactive-screen-ruler {
  position: relative;
  width: 100%;
  height: 120px;
  background: #fefce8;
  border: 2px solid #ca8a04;
  border-radius: 6px;
  overflow: hidden;
  user-select: none;
  cursor: crosshair;
}

/* Interactive Drag Markers */
.drag-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  z-index: 10;
  cursor: ew-resize;
}

.marker-start {
  left: 0px;
  background: #16a34a;
}
.marker-start .marker-handle {
  background: #16a34a;
}

.marker-end {
  left: 180px;
  background: #2563eb;
}
.marker-end .marker-handle {
  background: #2563eb;
}

.marker-handle {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: bold;
}

.marker-tooltip {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.screen-ruler-footer {
  margin-top: 0.75rem;
}

.tip-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Converter Utility Section */
.converter-section {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 1.75rem;
  margin: 2.5rem 0;
}

.converter-header {
  margin-bottom: 1.25rem;
}

.converter-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark);
}

.converter-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.converter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.convert-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.convert-box label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.convert-box input {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  outline: none;
}

.convert-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.convert-box input[readonly] {
  background: #f8fafc;
  color: var(--primary);
}

/* SEO Content Guide Section */
.content-guide-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.25rem;
  margin: 2.5rem 0;
  box-shadow: var(--shadow);
}

.content-guide-section h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 0.85rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0;
}

.step-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  position: relative;
}

.step-num {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.step-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.step-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Browser Tips Box */
.browser-tips-box {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.browser-tips-box h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1rem;
}

.browser-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  font-size: 0.9rem;
}

/* FAQ Accordion */
.faq-container {
  margin-top: 2rem;
}

.faq-container h2 {
  margin-bottom: 1rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background: #ffffff;
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  outline: none;
  background: #ffffff;
  transition: background 0.15s ease;
}

.faq-item summary:hover {
  background: #f8fafc;
}

.faq-answer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
  font-size: 0.92rem;
  color: var(--text);
}

/* Footer */
.site-footer {
  background: var(--dark);
  color: #94a3b8;
  padding: 3rem 0 1.5rem;
  margin-top: 3rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

.footer-desc {
  font-size: 0.875rem;
  margin-top: 0.75rem;
  max-width: 320px;
}

.site-footer .logo {
  color: #ffffff;
}

.site-footer h4 {
  color: #f1f5f9;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.site-footer ul {
  list-style: none;
  font-size: 0.875rem;
}

.site-footer ul li {
  margin-bottom: 0.5rem;
}

.site-footer ul li a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer ul li a:hover {
  color: #ffffff;
}

.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 1.5rem;
  font-size: 0.8rem;
  text-align: center;
}
