:root {
  --bg: #050807;
  --card: rgba(12, 20, 17, 0.92);
  --card-soft: rgba(18, 32, 27, 0.82);
  --text: #effff8;
  --muted: #8fb6a7;
  --line: rgba(81, 255, 177, 0.18);
  --accent: #46ffb3;
  --accent-2: #d6ffe9;
  --warn: #ffd166;
  --danger: #ff6b6b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(70, 255, 179, 0.12), transparent 35%),
    radial-gradient(circle at 80% 15%, rgba(70, 255, 179, 0.055), transparent 32%),
    linear-gradient(160deg, #020303 0%, #07120f 52%, #050807 100%);
}

button,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
  align-content: start;
}

.hero-card,
.language-card,
.translate-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-card {
  padding: 26px 22px 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: -55%;
  background: conic-gradient(from 120deg, transparent, rgba(70, 255, 179, 0.07), transparent 36%);
  animation: slowSpin 14s linear infinite;
}

.hero-card > * {
  position: relative;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.plasma-title {
  margin: 0;
  position: relative;
  display: inline-grid;
  place-items: center;
  min-height: clamp(3.8rem, 16vw, 6.8rem);
}

.plasma-core,
.plasma-glow {
  grid-area: 1 / 1;
  font-size: clamp(3.25rem, 15vw, 6.35rem);
  line-height: 0.9;
  letter-spacing: -0.08em;
  font-weight: 1000;
  text-transform: uppercase;
}

.plasma-core {
  position: relative;
  z-index: 2;
  color: #f5fff9;
  text-shadow:
    0 0 5px rgba(255,255,255,0.55),
    0 0 12px rgba(70,255,179,0.48),
    0 0 22px rgba(70,255,179,0.34),
    0 0 36px rgba(70,255,179,0.16);
}

.plasma-glow {
  z-index: 1;
  color: transparent;
  background: linear-gradient(90deg, rgba(70,255,179,0.15), rgba(255,255,255,0.9), rgba(70,255,179,0.15));
  -webkit-background-clip: text;
  background-clip: text;
  filter: blur(8px);
  opacity: 0.56;
  transform: scale(1.035);
  animation: plasmaPulse 3.2s ease-in-out infinite;
}

.plasma-rail {
  position: relative;
  width: min(380px, 78%);
  height: 8px;
  margin: 16px auto 0;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(70,255,179,0.08), rgba(70,255,179,0.3), rgba(70,255,179,0.08));
  box-shadow: inset 0 0 0 1px rgba(70,255,179,0.18), 0 0 10px rgba(70,255,179,0.10);
}

.plasma-rail span {
  display: block;
  width: 32%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(70,255,179,0), rgba(214,255,233,1), rgba(70,255,179,0));
  box-shadow: 0 0 12px rgba(70,255,179,0.46);
  animation: railSweep 2.5s linear infinite;
}

.language-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.select-group {
  display: grid;
  gap: 9px;
}

select {
  width: 100%;
  min-height: 56px;
  border: 1px solid rgba(143, 182, 167, 0.28);
  border-radius: 18px;
  padding: 0 46px 0 16px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(70, 255, 179, 0.08), rgba(2, 4, 4, 0.74)),
    rgba(2, 4, 4, 0.72);
  outline: none;
  font-size: 1.02rem;
  font-weight: 850;
}

select:focus {
  border-color: rgba(70, 255, 179, 0.72);
  box-shadow: 0 0 0 4px rgba(70, 255, 179, 0.08);
}

.language-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.translate-card,
.result-card {
  padding: 18px;
}

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.input-header label {
  margin: 0;
}

.saved-toggle {
  width: auto;
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
  font-size: 0.78rem;
}

label,
.result-label {
  display: block;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 164px;
  resize: vertical;
  border: 1px solid rgba(143, 182, 167, 0.28);
  border-radius: 20px;
  padding: 16px;
  color: var(--text);
  background: rgba(2, 4, 4, 0.72);
  outline: none;
  font-size: 1.08rem;
  line-height: 1.5;
}

textarea::placeholder {
  color: rgba(143, 182, 167, 0.55);
}

textarea:focus {
  border-color: rgba(70, 255, 179, 0.72);
  box-shadow: 0 0 0 4px rgba(70, 255, 179, 0.08);
}

.voice-button {
  width: 100%;
  min-height: 54px;
  margin: 0 0 8px;
  border: 1px solid rgba(70, 255, 179, 0.34);
  border-radius: 18px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(70, 255, 179, 0.16), rgba(2, 4, 4, 0.72));
  font-weight: 950;
  letter-spacing: 0.06em;
}

.voice-button:disabled {
  opacity: 0.48;
}

.voice-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 58px;
  margin-top: 14px;
  border: none;
  border-radius: 19px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.primary-button {
  color: #01150d;
  background: linear-gradient(135deg, var(--accent), #c4ffe3);
  box-shadow: 0 12px 28px rgba(70, 255, 179, 0.24);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.45;
}

.secondary-button {
  color: var(--text);
  background: rgba(70, 255, 179, 0.12);
  border: 1px solid rgba(70, 255, 179, 0.24);
}

.status-line {
  min-height: 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-line.error {
  color: var(--danger);
}

.status-line.warning {
  color: var(--warn);
}

.status-line.success {
  color: var(--accent);
}

.result-text {
  min-height: 90px;
  border: 1px dashed rgba(70, 255, 179, 0.24);
  border-radius: 20px;
  padding: 18px;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  background: rgba(0, 0, 0, 0.26);
  text-align: center;
  font-size: clamp(1.6rem, 6vw, 3rem);
  font-weight: 900;
  line-height: 1.15;
}

@keyframes slowSpin {
  to {
    transform: rotate(1turn);
  }
}

select:disabled {
  opacity: 0.62;
}

@keyframes plasmaPulse {
  0%, 100% { opacity: 0.42; transform: scale(1.012); }
  50% { opacity: 0.68; transform: scale(1.03); }
}

@keyframes railSweep {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(330%); }
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.result-actions-single {
  grid-template-columns: 1fr;
}

.mini-button,
.text-button {
  min-height: 46px;
  border-radius: 15px;
  color: var(--text);
  background: rgba(70, 255, 179, 0.085);
  border: 1px solid rgba(70, 255, 179, 0.22);
  font-weight: 900;
  letter-spacing: 0.03em;
}

.mini-button:disabled {
  opacity: 0.45;
}

.text-button {
  width: auto;
  min-height: 40px;
  padding: 0 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(143, 182, 167, 0.18);
}

.saved-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(8, 14, 12, 0.92);
  box-shadow: var(--shadow);
}

.input-saved-card {
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.24);
  box-shadow: none;
}

.saved-card[hidden] {
  display: none;
}

.saved-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.saved-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.saved-list {
  display: grid;
  gap: 10px;
}

.saved-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed rgba(70, 255, 179, 0.18);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.18);
}

.saved-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(70, 255, 179, 0.16);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
}

.saved-item:focus-within {
  border-color: rgba(70, 255, 179, 0.45);
}

.saved-pair {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.saved-source,
.saved-translation {
  margin: 0;
  line-height: 1.35;
}

.saved-source {
  color: var(--muted);
  font-size: 0.94rem;
}

.saved-translation {
  color: var(--accent-2);
  font-size: 1.08rem;
  font-weight: 850;
}

.saved-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.saved-actions button {
  min-height: 40px;
  border-radius: 13px;
  color: var(--text);
  background: rgba(70, 255, 179, 0.075);
  border: 1px solid rgba(70, 255, 179, 0.18);
  font-weight: 850;
}

@media (max-width: 420px) {
  .input-header {
    align-items: stretch;
    flex-direction: column;
  }

  .saved-toggle {
    width: 100%;
  }

  .result-actions,
  .saved-actions {
    grid-template-columns: 1fr;
  }
}


/* Transl8 1.0 page structure */
.page {
  display: block;
}

.page[hidden] {
  display: none !important;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-button {
  border: 1px solid rgba(103, 210, 255, 0.5);
  background: rgba(4, 15, 35, 0.72);
  color: #d9f7ff;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 0 18px rgba(64, 194, 255, 0.18);
}

.nav-button:active {
  transform: translateY(1px);
}

.saved-hero {
  margin-bottom: 16px;
}

.saved-title {
  margin: 18px 0 8px;
  font-size: clamp(2.3rem, 10vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: #f7fbff;
  text-shadow:
    0 0 16px rgba(46, 198, 255, 0.5),
    0 0 30px rgba(147, 80, 255, 0.4);
}

.saved-page-note {
  margin: 0;
  color: rgba(225, 241, 255, 0.78);
  font-size: 0.98rem;
  line-height: 1.45;
}

.saved-page-card {
  border: 1px solid rgba(71, 196, 255, 0.28);
  border-radius: 28px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(9, 21, 47, 0.95), rgba(7, 12, 30, 0.9)),
    radial-gradient(circle at top left, rgba(52, 208, 255, 0.18), transparent 38%),
    radial-gradient(circle at bottom right, rgba(173, 79, 255, 0.16), transparent 42%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), inset 0 0 30px rgba(51, 195, 255, 0.05);
}

.saved-page-toolbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.text-button.danger {
  color: #ffb9d3;
  border-color: rgba(255, 105, 180, 0.35);
}

.saved-list-page {
  display: grid;
  gap: 14px;
  max-height: none;
  overflow: visible;
}

.saved-list-page .saved-item {
  border: 1px solid rgba(103, 210, 255, 0.2);
  border-radius: 20px;
  padding: 14px;
  background: rgba(3, 12, 28, 0.72);
}

.saved-list-page .saved-source,
.saved-list-page .saved-translation {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.saved-list-page .saved-translation {
  font-size: 1.05rem;
  color: #f4f8ff;
}

@media (max-width: 430px) {
  .top-bar {
    align-items: flex-start;
  }

  .nav-button {
    padding: 9px 11px;
    font-size: 0.82rem;
  }

  .saved-page-toolbar {
    flex-direction: column;
  }

  .text-button.danger {
    align-self: flex-start;
  }
}

/* Web translation status */
.status-line.online {
  color: var(--accent);
}
