:root {
  --primary: #0e0e1c;
  --accent: #cfa76e;
  --bg: #0a0a12;
  --text: #ffffff;
  --muted: #888;
  --radius: 10px;
  --input-bg: #0e0e1c;
  --input-border: #333;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  padding: 0 1rem;
}

header {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--primary);
  color: var(--text);
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

header p {
  font-size: 1.1rem;
  max-width: 900px;
  margin: 0 auto;
  opacity: 0.85;
}

.main-nav a {
  display: inline-block;
  margin: 0 0.5rem;
  color: var(--accent);
  text-decoration: none;
}

.main-nav {
  margin-bottom: 0.5rem;
}

header img {
  display: block;
  margin: 0 auto 1rem;
  border-radius: 12px;
  width: 96px;
  height: 96px;
}

.section {
  max-width: 900px;
  margin: 1rem auto;
  padding: 0;
}

h2 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.section p {
  max-width: 70ch;
  margin-bottom: 1rem;
  line-height: 1.6;
}

input[type="url"],
input[type="text"],
select {
  width: 100%;
  padding: 0.7rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

#langSwitcher {
  width: auto;
  margin-bottom: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  border-radius: 6px;
}

.top-bar {
  text-align: right;
  padding: 0.5rem;
}

.muted-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin: -0.5rem 0 1rem;
}

.option-group {
  margin-bottom: 1rem;
}

.option-label {
  margin-right: 0.5rem;
}

.label-strong {
  font-weight: 600;
  margin-right: 0.25rem;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.text-right {
  text-align: right;
}

.info-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.info-text-small {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.instruction-text {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

select option:checked {
  background: var(--accent);
  color: var(--bg);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  background: none;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border-radius: var(--radius);
  cursor: pointer;
}

button:hover {
  background-color: var(--accent);
  color: var(--bg);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.preview {
  margin-top: 1.5rem;
  padding: 1rem;
  border-top: 1px solid var(--input-border);
  font-size: 0.95rem;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 70vh;
}

.summary-text {
  margin: 0.5rem 0 1rem;
  font-style: italic;
  color: var(--muted);
}

#cardPreview {
  margin-top: 1rem;
}

.card-container {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  font-size: 0.95rem;
  line-height: 1.4;
}


.card-carousel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  position: relative;
}

.card-carousel img {
  width: 250px;
  height: 250px;
  border-radius: 6px;
  object-fit: contain;
  flex: 0 0 auto;
}

.card-carousel .carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.card-carousel .carousel-arrow.left {
  left: 4px;
}

.card-carousel .carousel-arrow.right {
  right: 4px;
}

.card-container .card-info {
  flex: 1;
}

.card-container .card-info h3 {
  margin: 0 0 0.5rem;
}


.card-container .card-info .card-url {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.field {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--text);
}

.field a {
  color: var(--accent);
  text-decoration: underline;
}

.console-glass {
  background: transparent;
  color: #39ff14;
  padding: 1rem 0;
  font-size: 0.85rem;
  border-top: 1px solid var(--input-border);
  font-family: 'Courier New', monospace;
  overflow-y: auto;
  max-height: 300px;
}

.footer {
  text-align: center;
  font-size: 0.85rem;
  margin: 4rem 0 2rem;
  color: var(--muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

#toast, .toast {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #e5484d;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.spinner {
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  margin: 0;
}

#spinner,
.spinner-container {
  display: none;
  align-items: center;
  margin-left: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

pre {
  padding: 1rem;
  font-size: 0.85rem;
  background: transparent;
  color: var(--text);
  border-left: 2px solid var(--accent);
  font-family: monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  margin-bottom: 1rem;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-top: 0.5rem;
  align-items: center;
}

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

.mode-tabs button {
  flex: 1;
  padding: 0.5rem 1rem;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  cursor: pointer;
}

.mode-tabs button.active {
  background: var(--accent);
  color: var(--bg);
}

.group-block {
  margin-top: 1rem;
}

.group-toggle {
  color: var(--text);
  font-weight: 600;
  width: 100%;
  text-align: left;
  border: none;
  padding: 0.75rem 1rem;
  line-height: 1.4;
  cursor: pointer;
  border-bottom: 1px solid var(--input-border);
  background: #1a1a1a;
}
.group-toggle input[type="checkbox"] {
  margin-right: 0.5rem;
}

[id^="group-"] {
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.results-section {
  border-top: 1px solid var(--input-border);
  padding-top: 1rem;
  margin-top: 2rem;
}

.results-section h2 {
  margin-bottom: 1rem;
}

#singleMode input[type="text"],
#batchMode textarea,
#batchMode input[type="file"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  margin-bottom: 1rem;
  background-color: transparent;
  color: white;
}

.input-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}

.contact-form input,
.contact-form textarea {
  padding: 0.7rem;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.contact-form button {
  align-self: flex-start;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.8rem 1.4rem;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

.branches-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.array-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.array-card {
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0.5rem;
  background: var(--input-bg);
}

.array-card div {
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.branch-card {
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0.5rem;
  background: var(--input-bg);
}

.branch-card div {
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.google-results {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.google-result {
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: var(--input-bg);
}

.google-result a {
  color: var(--accent);
  text-decoration: none;
}

.google-result p {
  margin: 0.25rem 0 0;
}

#progressBar, .progress-bar {
  margin-top: 1rem;
  height: 6px;
  background: #eee;
  border-radius: 4px;
}

#progress, .progress {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}

.table-responsive {
  width: 95%;
  max-width: 95%;
  overflow-x: hidden;
}

.result-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  table-layout: fixed;
  box-sizing: border-box;
}

.result-table th,
.result-table td {
  border: 1px solid #444;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.4;
}

.result-table th a,
.result-table td a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-col {
  width: 40px;
  white-space: nowrap;
}

.field-name {
  background: var(--primary);
  color: var(--accent);
  font-weight: 600;
  width: 25%;
}

.result-table th {
  background: var(--primary);
  color: var(--accent);
  font-weight: 600;
}

.result-table img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 4px;
}

.result-table tbody tr:nth-child(even) {
  background: #1a1a1a;
}

.result-table tbody tr:hover {
  background: #2a2a2a;
}

.other-toggle {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.other-toggle:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .result-table tr {
    display: block;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #444;
  }

  .result-table td,
  .result-table th {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .result-table .select-col {
    width: auto;
    margin-bottom: 0.25rem;
  }

  .result-table .field-name {
    display: none;
  }

  .result-table .field-value::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--accent);
  }
}

#jobList {
  margin-top: 1rem;
}

.job-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.job-row .chip {
  padding: 0.1rem 0.4rem;
  border-radius: 12px;
  font-size: 0.75rem;
  color: #fff;
}

.job-row .chip.loading,
.job-row .chip.queued,
.job-row .chip.running {
  background: #555;
}

.job-row .chip.ok {
  background: #228b22;
}

.job-row .chip.fail {
  background: #b30000;
}

.job-row .chip.timeout {
  background: #b36b00;
}

.job-row .retry-btn {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
}



