:root {
  --bg: #0F172A;
  --bg-elev: #1E293B;
  --bg-card: #162035;
  --border: #1c2d4a;
  --border-strong: #2a3f5f;
  --text: #ececf1;
  --text-dim: #8a8a99;
  --text-muted: #5a5a6a;
  --accent: #6ee7ff;
  --accent-glow: rgba(110, 231, 255, 0.18);
  --danger: #ff6b6b;
  --success: #7ef0a3;
  --radius: 14px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(59, 130, 246, 0.08), transparent 70%),
    radial-gradient(800px 500px at 100% 100%, rgba(99, 102, 241, 0.05), transparent 60%),
    var(--bg);
}

html[dir="rtl"] body { text-align: right; }

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero {
  text-align: center;
  padding: 16px 8px 8px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-bolt {
  width: 18px;
  height: 18px;
  background: var(--accent);
  clip-path: polygon(45% 0, 100% 0, 55% 45%, 100% 45%, 0 100%, 45% 55%, 0 55%);
  box-shadow: 0 0 18px var(--accent-glow);
}

.brand {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.tagline {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
  margin: 6px 0 0;
  max-width: 420px;
  display: inline-block;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: rgba(110, 231, 255, 0.08);
  border: 1px solid rgba(110, 231, 255, 0.18);
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.card h2 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 0 var(--border-strong);
}

.tab-body.hidden { display: none; }

textarea, input[type="text"] {
  width: 100%;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

textarea {
  min-height: 110px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}

textarea::placeholder, input::placeholder {
  color: var(--text-muted);
}

textarea:focus, input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
}

#recv-code {
  font-family: var(--font-mono);
  font-size: 22px;
  text-align: center;
  letter-spacing: 0.6em;
  padding-left: calc(14px + 0.3em);
  font-weight: 500;
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  cursor: pointer;
  text-align: center;
  color: var(--text-dim);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.file-drop:hover {
  border-color: var(--accent);
  color: var(--text);
}

.file-icon {
  font-size: 22px;
  color: var(--accent);
  font-weight: 300;
  line-height: 1;
}

.file-text { font-size: 13px; }
.file-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  word-break: break-all;
}

.primary {
  background: var(--accent);
  color: #04141a;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 0 1px rgba(110, 231, 255, 0.25), 0 8px 28px -16px var(--accent);
}

.primary:hover { filter: brightness(1.05); }
.primary:active { transform: translateY(1px); }
.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.flash-display {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.flash-display.hidden { display: none; }

.code-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.code-label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

.code {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
  direction: ltr;
  text-align: center;
  width: 100%;
}

.countdown {
  display: flex;
  align-items: center;
  gap: 10px;
}

.countdown-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-card);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.countdown-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), #b4f8ff);
  transition: width 0.25s linear;
  border-radius: 999px;
}

.countdown-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  min-width: 32px;
  text-align: right;
}

html[dir="rtl"] .countdown-text { text-align: left; }

.result {
  margin-top: 4px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow: auto;
}

.result.hidden { display: none; }
.result.error { color: var(--danger); border-color: rgba(255, 107, 107, 0.3); }
.result.file { display: flex; align-items: center; gap: 10px; }
.result .file-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.result .file-link:hover { text-decoration: underline; }

.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  z-index: 50;
  max-width: calc(100% - 32px);
}

.toast.hidden { display: none; }

@media (max-width: 480px) {
  .shell { padding: 20px 16px 60px; }
  .code { font-size: 34px; }
  .brand { font-size: 22px; }
}
