:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #000000;
  --line: #2f3336;
  --text: #e7e9ea;
  --muted: #71767b;
  --muted-2: #8b98a5;
  --blue: #1d9bf0;
  --blue-hover: #1a8cd8;
  --surface: #16181c;
  --surface-2: #0f1419;
  --green: #00ba7c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

body {
  min-height: 100vh;
}

.shell {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--panel);
  min-height: 100vh;
}

.hero {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 1rem;
}

.hero h1 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.notice {
  margin: 0;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(241, 196, 15, 0.24);
  background: rgba(241, 196, 15, 0.1);
  color: #ffe7a2;
  font-size: 0.92rem;
  line-height: 1.35;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.custom-panel {
  border-bottom: 1px solid var(--line);
  padding: 0.95rem 1rem 1rem;
  background: #000;
}

.custom-toggle-wrap {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #000;
}

.custom-toggle-btn {
  min-width: 15rem;
}

.custom-title {
  margin: 0 0 0.6rem;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
}

.custom-input {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.8rem 0.9rem;
  font: inherit;
  line-height: 1.45;
}

.custom-input::placeholder {
  color: var(--muted);
}

.custom-input:focus {
  outline: none;
  border-color: rgba(29, 155, 240, 0.55);
  box-shadow: 0 0 0 1px rgba(29, 155, 240, 0.35);
}

.custom-actions {
  margin-top: 0.65rem;
  display: flex;
  justify-content: flex-start;
}

.custom-translate-btn {
  min-width: 7.5rem;
  min-height: 2.2rem;
  padding-inline: 0.95rem;
}

.custom-result {
  margin-top: 0.75rem;
}

.custom-result .pane-label {
  margin-bottom: 0.35rem;
}

.timeline-wrap {
  width: 100%;
}

.timeline {
  display: block;
}

.tweet-card {
  border-bottom: 1px solid var(--line);
  background: #000;
  transition: background-color 120ms ease;
  animation: rise 180ms ease-out both;
}

.tweet-card:hover {
  background: rgba(255, 255, 255, 0.015);
}

.tweet-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.85rem;
}

.tweet-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(145deg, #30363d, #14171a);
  border: 1px solid #3a3f45;
  color: #f5f7fa;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
}

.tweet-main {
  min-width: 0;
}

.tweet-head {
  margin-bottom: 0.35rem;
}

.tweet-author-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.tweet-name {
  font-weight: 700;
  color: var(--text);
}

.tweet-handle,
.tweet-time,
.tweet-dot {
  color: var(--muted);
  font-size: 0.92rem;
}

.tweet-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #000;
}

.tweet-block + .tweet-block {
  margin-top: 0.6rem;
}

.original-block {
  padding: 0.8rem 0.9rem;
}

.decoded-block {
  background: rgba(29, 155, 240, 0.06);
  border-color: rgba(29, 155, 240, 0.22);
  padding: 0.75rem 0.85rem 0.8rem;
}

.decode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.pane-label {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tweet-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.42;
  color: var(--text);
  font-size: 0.97rem;
}

.tweet-text.decoded {
  color: #dceeff;
}

.tweet-placeholder {
  color: var(--muted);
  font-style: italic;
}

button {
  appearance: none;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
}

.translate-btn {
  border-radius: 999px;
  min-height: 2rem;
  padding: 0.35rem 0.8rem;
  background: var(--blue);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, opacity 120ms ease;
}

.translate-btn:hover {
  background: var(--blue-hover);
}

.translate-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tweet-footer {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(113, 118, 123, 0.34);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.22rem 0.5rem;
  color: var(--muted-2);
  font-size: 0.75rem;
}

.chip.soft {
  background: rgba(29, 155, 240, 0.08);
  border-color: rgba(29, 155, 240, 0.25);
}

.tweet-link {
  margin-left: auto;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.tweet-link:hover {
  text-decoration: underline;
}

.history-controls {
  display: flex;
  justify-content: center;
  padding: 0.9rem 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.history-btn {
  min-width: 14rem;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.history-btn:hover {
  background: rgba(29, 155, 240, 0.1);
}

.history-btn:disabled {
  color: var(--muted);
  cursor: progress;
}

.history-btn[hidden] {
  display: none;
}

.empty {
  margin: 0;
  padding: 1.2rem 1rem;
  color: var(--muted-2);
  border-bottom: 1px solid var(--line);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .shell {
    max-width: 100%;
    border-left: none;
    border-right: none;
  }

  .tweet-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 0.65rem;
    padding-inline: 0.85rem;
  }

  .tweet-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .decode-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .tweet-link {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
