:root {
  --bg: #1c1e21;
  --glass: rgba(38, 42, 47, 0.72);
  --glass-strong: rgba(48, 54, 61, 0.9);
  --text: #ffffff;
  --secondary: #e4e6eb;
  --muted: #b0b3b8;
  --accent: #00d4ff;
  --accent-2: #65d46e;
  --warn: #ffd166;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 600px;
  height: 600px;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  display: grid;
  place-items: center;
}

#app {
  width: 600px;
  height: 600px;
  position: relative;
  background:
    radial-gradient(circle at 50% 38%, rgba(0, 212, 255, 0.12), transparent 35%),
    linear-gradient(180deg, #23272d 0%, #17191d 100%);
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  padding: 24px 16px 16px;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.hud-topbar,
.app-header {
  min-height: 64px;
  display: grid;
  align-items: center;
  gap: 10px;
}

.hud-topbar {
  grid-template-columns: 1fr auto;
}

.app-header.compact {
  grid-template-columns: 64px 1fr 64px;
  text-align: center;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-pill {
  min-width: 104px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--glass-strong);
  color: var(--secondary);
  font-size: 14px;
  font-weight: 850;
  text-align: center;
}

.status-pill.listening {
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(101, 212, 110, 0.55);
}

.status-pill.translating {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.46);
}

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

.listening-field {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 185px;
}

.signal-ring {
  width: 156px;
  height: 156px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0.78;
}

.signal-ring::before {
  content: "";
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--glass-strong);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.18);
}

.signal-ring span {
  position: absolute;
  bottom: 58px;
  width: 8px;
  border-radius: 8px;
  background: var(--accent);
  opacity: 0.92;
}

.signal-ring span:nth-child(1) {
  height: 22px;
  transform: translateX(-18px);
}

.signal-ring span:nth-child(2) {
  height: 42px;
}

.signal-ring span:nth-child(3) {
  height: 28px;
  transform: translateX(18px);
}

.signal-ring.active {
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.35), 0 0 34px rgba(0, 212, 255, 0.2);
}

.signal-ring.active span:nth-child(1) {
  animation: meter 0.76s ease-in-out infinite;
}

.signal-ring.active span:nth-child(2) {
  animation: meter 0.64s ease-in-out infinite reverse;
}

.signal-ring.active span:nth-child(3) {
  animation: meter 0.82s ease-in-out infinite;
}

@keyframes meter {
  0%,
  100% {
    height: 18px;
  }
  50% {
    height: 50px;
  }
}

.subtitle-stage {
  min-height: 204px;
  margin-bottom: 12px;
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20, 23, 26, 0.38), rgba(20, 23, 26, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.16);
}

.source-line {
  color: var(--secondary);
  font-size: 18px;
  line-height: 1.25;
  max-height: 48px;
  overflow: hidden;
}

.subtitle-line {
  color: var(--text);
  font-size: 36px;
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0;
  max-height: 118px;
  overflow: hidden;
  text-wrap: balance;
}

.subtitle-line.preview {
  color: var(--secondary);
}

.subtitle-meta {
  min-height: 20px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.quick-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

button,
textarea {
  font: inherit;
}

button {
  min-height: 76px;
  border: 0;
  border-radius: 8px;
  background: var(--glass-strong);
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  opacity: 0.86;
}

button.primary {
  background: var(--accent);
  color: #061116;
}

.wide {
  width: 100%;
}

.icon-button {
  width: 56px;
  min-height: 56px;
  justify-self: center;
  font-size: 22px;
}

.focusable:focus {
  outline: none;
  opacity: 1;
  transform: scale(0.96);
  box-shadow: 0 0 0 3px var(--accent), 0 0 20px rgba(0, 212, 255, 0.48);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 8px;
}

.setting-row {
  min-height: 74px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  text-align: left;
}

.setting-row span {
  color: var(--muted);
  font-size: 15px;
}

.setting-row strong {
  color: var(--text);
  font-size: 18px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 470px;
  overflow-y: auto;
}

.history-item {
  padding: 12px;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.history-item p {
  font-size: 15px;
  line-height: 1.28;
}

.history-item strong {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-size: 18px;
  line-height: 1.2;
}

.empty {
  padding: 26px 14px;
  color: var(--muted);
  text-align: center;
}

.manual-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 14px;
  background: var(--glass);
  color: var(--text);
  font-size: 20px;
  line-height: 1.3;
}

@media (max-width: 599px), (max-height: 599px) {
  html,
  body,
  #app {
    width: 100vw;
    height: 100vh;
  }

  .screen {
    padding: 18px 12px 12px;
  }

  .subtitle-line {
    font-size: 31px;
  }
}
