html,
body {
  height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 24%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.1), transparent 20%),
    var(--bg-gradient);
  overflow: hidden;
  height: 100vh;
}

.re-header,
.re-topbar,
.re-main {
  padding-left: 24px;
  padding-right: 24px;
}

.re-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.re-header-left,
.re-header-right,
.re-panel-header,
.re-topbar,
.re-panel-title,
.re-actions,
.re-toolbar,
.re-detect-header,
.re-stats {
  display: flex;
  align-items: center;
}

.re-header-left,
.re-header-right {
  gap: 12px;
}

.re-logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.re-subtitle,
.re-back-link {
  font-size: 13px;
  color: var(--muted);
}

.re-back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.re-topbar {
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.re-topbar-copy {
  min-width: 0;
}

.re-topbar-copy p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 760px;
}

.re-topbar-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.re-stats {
  gap: 10px;
  flex-shrink: 0;
}

.re-stat-card,
.re-panel,
.re-side-panel,
.re-diff-card,
.re-detect-box,
.re-hint-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

.re-stat-card {
  min-width: 108px;
  padding: 12px 14px;
}

.re-stat-label,
.re-diff-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
}

.re-stat-card strong,
.re-diff-card strong {
  font-size: 20px;
  line-height: 1;
}

.re-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.72fr) minmax(0, 1.15fr);
  gap: 18px;
  flex: 1;
  min-height: 0;
  padding-top: 18px;
  padding-bottom: 18px;
}

.re-panel,
.re-side-panel {
  min-height: 0;
}

.re-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.re-panel-header {
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.re-panel-title {
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.re-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.re-dot-blue { background: #60a5fa; }
.re-dot-green { background: #22c55e; }
.re-dot-gold { background: #fbbf24; }

.re-mini-btn,
.re-btn,
.re-preset,
.re-inline-input,
.re-textarea {
  font-family: inherit;
}

.re-mini-btn {
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
}

.re-mini-btn:hover,
.re-preset:hover,
.re-btn-outline:hover {
  background: var(--surface-hover);
}

.re-preset-row,
.re-actions,
.re-option-group,
.re-checkbox-grid,
.re-diff-grid {
  display: grid;
  gap: 10px;
}

.re-preset-row {
  grid-template-columns: repeat(4, 1fr);
  padding: 16px 18px 0;
  flex-shrink: 0;
}

.re-preset {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  cursor: pointer;
}

.re-preset.active {
  border-color: rgba(59, 130, 246, 0.34);
  background: rgba(59, 130, 246, 0.1);
  color: #dbeafe;
}

.re-textarea {
  width: calc(100% - 36px);
  margin: 16px 18px 0;
  flex: 1;
  min-height: 0;
  resize: none;
  border: 1px solid var(--border);
  background: rgba(4, 10, 20, 0.35);
  color: var(--text);
  border-radius: 16px;
  padding: 18px;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
}

.re-textarea:focus,
.re-inline-input:focus {
  border-color: rgba(59, 130, 246, 0.36);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.re-output {
  color: #d7f9e6;
}

.re-actions {
  grid-template-columns: repeat(3, 1fr);
  padding: 16px 18px 18px;
  flex-shrink: 0;
}

.re-btn {
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.re-btn-primary {
  border-color: rgba(37, 99, 235, 0.45);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.re-btn-primary:hover {
  filter: brightness(1.05);
}

.re-btn-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.re-side-panel {
  padding: 18px;
  overflow: auto;
}

.re-option-group {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
}

.re-option,
.re-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.re-inline-input {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  background: rgba(4, 10, 20, 0.35);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 13px;
  outline: none;
}

.re-checkbox-grid {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

.re-detect-box,
.re-hint-card {
  padding: 16px;
}

.re-detect-box {
  margin-bottom: 14px;
}

.re-detect-header {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.re-detect-header h3,
.re-hint-card h3 {
  font-size: 13px;
}

.re-detect-header span,
.re-hint-card li {
  font-size: 12px;
  color: var(--muted);
}

.re-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

.re-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.18);
  font-size: 12px;
  color: #fde68a;
}

.re-token-empty {
  font-size: 12px;
  color: var(--muted2);
}

.re-hint-card ul {
  list-style: none;
}

.re-hint-card li {
  line-height: 1.7;
  padding: 5px 0;
}

.re-hint-card li::before {
  content: '·';
  color: var(--accent);
  font-weight: 700;
  margin-right: 8px;
}

.re-diff-grid {
  grid-template-columns: repeat(3, 1fr);
  padding: 16px 18px 18px;
  flex-shrink: 0;
}

.re-diff-card {
  padding: 14px 16px;
}

.re-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #fff;
  font-size: 12px;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40;
}

.re-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-theme="light"] .re-header {
  background: rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .re-stat-card,
[data-theme="light"] .re-panel,
[data-theme="light"] .re-side-panel,
[data-theme="light"] .re-diff-card,
[data-theme="light"] .re-detect-box,
[data-theme="light"] .re-hint-card {
  background: rgba(255, 255, 255, 0.76);
}

[data-theme="light"] .re-preset.active {
  color: var(--accent);
}

[data-theme="light"] .re-output {
  color: #14532d;
}

@media (max-width: 1200px) {
  .re-main {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .re-panel,
  .re-side-panel {
    min-height: 320px;
  }
}

@media (max-width: 768px) {
  body {
    overflow: auto;
    height: auto;
  }

  .re-header,
  .re-topbar,
  .re-main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .re-header,
  .re-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .re-stats,
  .re-preset-row,
  .re-actions,
  .re-option-group,
  .re-checkbox-grid,
  .re-diff-grid {
    grid-template-columns: 1fr;
  }

  .re-textarea {
    width: calc(100% - 32px);
    min-height: 260px;
  }
}
