:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #101622;
  --bg-tertiary: #162032;
  --bg-card: rgba(18, 25, 38, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-jp: 'Noto Sans JP', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #34d399;
}

.status-badge.offline {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

.status-dot.pulse {
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* CONTAINER */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* HERO */
.hero-section {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 0.5rem;
}

.hero-section h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}

.hero-section p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* CARDS */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

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

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.sample-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sample-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 9999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

/* TEXTAREA */
.textarea-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

textarea {
  width: 100%;
  background: rgba(10, 13, 20, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--text-primary);
  font-family: var(--font-jp), var(--font-main);
  font-size: 1.05rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* ACTION BAR */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.action-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* OPTIONS BAR */
.options-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.model-select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.model-select-wrapper select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

/* LANGUAGE SELECTOR BOX */
.lang-selection-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lang-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.lang-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.lang-presets {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.preset-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.preset-pill.active {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.4);
  color: #38bdf8;
  font-weight: 600;
}

.lang-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
}

.lang-check-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.lang-check-item input[type="checkbox"] {
  display: none;
}

.custom-check {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lang-check-item input[type="checkbox"]:checked + .custom-check {
  background: #0ea5e9;
  border-color: #0ea5e9;
}

.lang-check-item input[type="checkbox"]:checked + .custom-check::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.badge-mini {
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  margin-left: 0.2rem;
}

.speed-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
}

/* LIVE PROGRESS CARD */
.progress-card {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(99, 102, 241, 0.08));
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.progress-status-box {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.progress-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #38bdf8;
}

.progress-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-metrics {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.timer-badge {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #38bdf8;
}

.percent-badge {
  background: #0ea5e9;
  color: #ffffff;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-cancel {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background: rgba(244, 63, 94, 0.25);
  color: #ffffff;
  border-color: #f43f5e;
  transform: translateY(-1px);
}

.btn-cancel-mini {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel-mini:hover {
  background: rgba(244, 63, 94, 0.3);
  color: #ffffff;
  border-color: #f43f5e;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* SHIMMER EFFECT FOR PENDING TRANSLATIONS */
.shimmer-text {
  display: inline-block;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
  position: relative;
  overflow: hidden;
}

.shimmer-text::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}


/* TOOLBAR */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.view-tabs {
  display: flex;
  background: rgba(10, 13, 20, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.3rem;
  gap: 0.3rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.tab-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-tool {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* VIEW 1: VERSE CARDS */
.verse-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.verse-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}

.verse-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateY(-2px);
}

.verse-card.empty-stanza {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.06);
  padding: 0.6rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.verse-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.verse-original {
  font-family: var(--font-jp);
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.03em;
}

.verse-copy-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.verse-copy-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.verse-romaji {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #38bdf8;
  margin-bottom: 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.verse-translations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.trans-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: rgba(10, 13, 20, 0.5);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
}

.trans-item.es { border-left-color: #f59e0b; }
.trans-item.pt { border-left-color: #10b981; }
.trans-item.en { border-left-color: #8b5cf6; }

.trans-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.trans-text {
  font-size: 0.92rem;
  color: var(--text-primary);
}

/* VIEW 2: 4-COLUMNS TABLE */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.lyrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.lyrics-table th {
  background: rgba(10, 13, 20, 0.9);
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
}

.lyrics-table td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top;
}

.lyrics-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.lyrics-table .col-jp {
  font-family: var(--font-jp);
  font-weight: 600;
  color: #ffffff;
}

.lyrics-table .col-romaji {
  font-family: var(--font-mono);
  color: #38bdf8;
}

/* VIEW 3: FULL TEXT */
.fulltext-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.subtabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.subtab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
}

.subtab-btn.active {
  background: #38bdf8;
  color: #0a0d14;
  border-color: #38bdf8;
  font-weight: 700;
}

.fulltext-box-wrapper {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.copy-all-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 0.4rem 0.8rem;
}

.copy-all-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.fulltext-content {
  font-family: var(--font-main);
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10b981;
  color: #ffffff;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 768px) {
  .navbar { padding: 0.8rem 1rem; }
  .container { padding: 1.25rem 1rem; }
  .hero-section h2 { font-size: 1.4rem; }
  .verse-translations { grid-template-columns: 1fr; }
}
