/* ============================================================
   Roman Numeral Font Generator — rnfg-style.css
   All classes prefixed with .rnfg- to avoid collisions
   ============================================================ */

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f0f4;
  color: #1a1a2e;
  min-height: 100vh;
  padding: 2.5rem 1.5rem;
}

/* ── Layout ── */
.rnfg-container {
  max-width: 820px;
  margin: 0 auto;
}

/* ── Header ── */
.rnfg-header {
  margin-bottom: 2rem;
}
.rnfg-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.rnfg-header p {
  font-size: 14px;
  color: #666;
}

/* ── Cards ── */
.rnfg-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e4e4e8;
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.rnfg-card-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 1.25rem;
}

/* ── Grids ── */
.rnfg-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.rnfg-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}
.rnfg-mb {
  margin-bottom: 1rem;
}
@media (max-width: 560px) {
  .rnfg-grid-2,
  .rnfg-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ── Fields ── */
.rnfg-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.rnfg-field label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.03em;
}
.rnfg-field-narrow {
  max-width: 240px;
}
.rnfg-hint {
  font-size: 12px;
  color: #999;
  margin-top: 10px;
}
.rnfg-hint i {
  margin-right: 5px;
}

/* ── Inputs & Selects ── */
.rnfg-input,
.rnfg-select {
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a2e;
  background: #fafafa;
  border: 1.5px solid #e0e0e8;
  border-radius: 10px;
  width: 100%;
  transition: border-color 0.15s;
}
.rnfg-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.rnfg-input:focus,
.rnfg-select:focus {
  outline: none;
  border-color: #4f6af5;
  background: #fff;
}
.rnfg-input.error {
  border-color: #e05555;
}

/* ── Sliders ── */
.rnfg-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rnfg-slider-wrap input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: #e0e0e8;
  border-radius: 4px;
  outline: none;
}
.rnfg-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #4f6af5;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(79, 106, 245, 0.35);
}
.rnfg-slider-wrap input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #4f6af5;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
}
.rnfg-slider-val {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
  min-width: 48px;
  text-align: right;
}

/* ── Color Swatches ── */
.rnfg-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}
.rnfg-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.rnfg-swatch:hover {
  transform: scale(1.15);
}
.rnfg-swatch.active {
  border-color: #4f6af5;
  box-shadow: 0 0 0 2px #fff inset;
}
.rnfg-cpick {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px dashed #bbb;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.rnfg-cpick input[type="color"] {
  position: absolute;
  top: -4px;
  left: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border: none;
  cursor: pointer;
  background: none;
}

/* ── Background Buttons ── */
.rnfg-bg-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.rnfg-bg-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 20px;
  cursor: pointer;
  border: 1.5px solid #e0e0e8;
  background: #fafafa;
  color: #555;
  transition: all 0.12s;
}
.rnfg-bg-btn:hover {
  border-color: #4f6af5;
  color: #4f6af5;
}
.rnfg-bg-btn.active {
  border-color: #4f6af5;
  background: #eef1ff;
  color: #4f6af5;
  font-weight: 600;
}

/* ── Font Dropdown ── */
.rnfg-font-select-wrap {
  position: relative;
}
.rnfg-font-display {
  height: 40px;
  padding: 0 32px 0 12px;
  font-size: 14px;
  background: #fafafa;
  border: 1.5px solid #e0e0e8;
  border-radius: 10px;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: border-color 0.15s;
  position: relative;
}
.rnfg-font-display:hover,
.rnfg-font-display.open {
  border-color: #4f6af5;
  background: #fff;
}
.rnfg-fd-name {
  font-size: 14px;
  color: #1a1a2e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rnfg-fd-preview {
  font-size: 16px;
  color: #555;
  margin-left: 8px;
  flex-shrink: 0;
}
.rnfg-font-display i {
  position: absolute;
  right: 12px;
  font-size: 11px;
  color: #999;
}
.rnfg-font-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid #4f6af5;
  border-radius: 12px;
  overflow: hidden;
  z-index: 999;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.rnfg-font-dropdown.open {
  display: block;
}
.rnfg-font-opt-item {
  padding: 9px 14px;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
  transition: background 0.1s;
}
.rnfg-font-opt-item:hover {
  background: #f4f4f8;
}
.rnfg-font-opt-item.selected {
  background: #eef1ff;
}
.rnfg-foi-label {
  font-size: 13px;
  color: #555;
  white-space: nowrap;
  min-width: 130px;
}
.rnfg-foi-sample {
  font-size: 18px;
  color: #1a1a2e;
}

/* ── Preview ── */
.rnfg-preview-card {
  background: #fff;
  border-radius: 16px;
  border: 2px solid transparent;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: background 0.2s, border-color 0.15s, box-shadow 0.15s;
}
.rnfg-preview-card.rnfg-flash {
  border-color: #4f6af5;
  box-shadow: 0 0 0 4px rgba(79, 106, 245, 0.18), 0 2px 8px rgba(0, 0, 0, 0.04);
}
.rnfg-preview-text {
  transition: all 0.2s ease;
  word-break: break-word;
  line-height: 1.3;
  text-align: center;
  max-width: 100%;
}
.rnfg-preview-sublabel {
  font-family: 'Segoe UI', sans-serif;
  font-size: 12px;
  color: #aaa;
  margin-top: 14px;
  letter-spacing: 0.04em;
}

/* ── Conversion & Breakdown ── */
.rnfg-error-msg {
  font-size: 13px;
  color: #c0392b;
  background: #fff0f0;
  border: 1px solid #f5c6c6;
  padding: 9px 14px;
  border-radius: 10px;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 7px;
}
.rnfg-conversion {
  font-size: 13px;
  color: #888;
  margin-bottom: 1rem;
  min-height: 20px;
}
.rnfg-conversion strong {
  color: #1a1a2e;
  font-weight: 600;
}
.rnfg-breakdown {
  font-size: 13px;
  color: #888;
  background: #f8f8fb;
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 1.25rem;
  min-height: 38px;
  line-height: 1.6;
  display: none;
}
.rnfg-breakdown span {
  font-weight: 600;
  color: #4f6af5;
}

/* ── Scale Row ── */
.rnfg-scale-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.rnfg-scale-label {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.rnfg-scale-btns {
  display: flex;
  gap: 6px;
}
.rnfg-scale-btn {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid #e0e0e8;
  background: #fafafa;
  color: #555;
  transition: all 0.12s;
}
.rnfg-scale-btn.active {
  border-color: #4f6af5;
  background: #eef1ff;
  color: #4f6af5;
}

/* ── Action Buttons ── */
.rnfg-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.rnfg-btn {
  height: 40px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  cursor: pointer;
  border: 1.5px solid #e0e0e8;
  background: #fff;
  color: #1a1a2e;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.12s;
  white-space: nowrap;
}
.rnfg-btn:hover {
  background: #f4f4f6;
  border-color: #bbb;
}
.rnfg-btn:active {
  transform: scale(0.97);
}
.rnfg-btn-primary {
  background: #4f6af5;
  color: #fff;
  border-color: #4f6af5;
}
.rnfg-btn-primary:hover {
  background: #3d57e0;
  border-color: #3d57e0;
}

/* ── Description ── */
.rnfg-desc {
  max-width: 820px;
  margin: 2.5rem auto 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #1a1a2e;
  padding-bottom: 3rem;
}
.rnfg-desc h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #1a1a2e;
  letter-spacing: -0.3px;
}
.rnfg-desc h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: #1a1a2e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rnfg-desc p {
  font-size: 15px;
  line-height: 1.75;
  color: #3a3a4e;
  margin-bottom: 1rem;
}
.rnfg-desc strong {
  font-weight: 700;
  color: #1a1a2e;
}
.rnfg-desc a {
  color: #4f6af5;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.rnfg-desc a:hover {
  color: #3d57e0;
}
.rnfg-desc hr {
  border: none;
  border-top: 1px solid #e4e4e8;
  margin: 1.75rem 0;
}
.rnfg-desc ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1rem;
}
.rnfg-desc ul li {
  font-size: 15px;
  line-height: 1.75;
  color: #3a3a4e;
  padding: 0.2rem 0 0.2rem 1.4rem;
  position: relative;
}
.rnfg-desc ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4f6af5;
}
.rnfg-desc ol {
  padding-left: 1.35rem;
  margin-bottom: 1rem;
}
.rnfg-desc ol li {
  font-size: 15px;
  line-height: 1.75;
  color: #3a3a4e;
  padding: 0.2rem 0;
}
.rnfg-desc ol li::marker {
  color: #4f6af5;
  font-weight: 700;
}
.rnfg-desc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 1.25rem;
}
.rnfg-desc thead tr {
  background: #f0f0f6;
}
.rnfg-desc th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #888;
  border-bottom: 2px solid #e4e4e8;
}
.rnfg-desc td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f4;
  color: #3a3a4e;
  vertical-align: top;
}
.rnfg-desc tbody tr:last-child td {
  border-bottom: none;
}
.rnfg-desc tbody tr:hover td {
  background: #fafafe;
}
.rnfg-desc code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: #f0f0f6;
  padding: 2px 6px;
  border-radius: 5px;
  color: #4f6af5;
}
.rnfg-note {
  background: #eef1ff;
  border-left: 3px solid #4f6af5;
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  font-size: 14px;
  color: #3a3a4e;
  margin-bottom: 1rem;
}