:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface2: #252542;
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --accent: #e74c3c;
  --accent2: #2ecc71;
  --accent3: #f1c40f;
  --accent4: #e67e22;
  --border: #333355;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "Fira Code", "Consolas", monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

header {
  text-align: center;
  padding: 30px 0 20px;
  position: relative;
}

.lang-switch {
  position: absolute;
  top: 10px;
  right: 0;
}

.lang-switch a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color .2s, border-color .2s;
}

.lang-switch a:hover {
  color: var(--text);
  border-color: var(--accent);
}

h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.subtitle {
  color: var(--text-dim);
  font-size: 16px;
  margin-top: 6px;
}

main {
  padding: 20px 0;
}

.input-section textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 16px;
  font-family: var(--font);
  resize: vertical;
  min-height: 120px;
  transition: border-color .2s;
}

.input-section textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.example-btn {
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  max-width: 100%;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.example-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.analyze-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}

.analyze-btn:hover { opacity: 0.9; }
.analyze-btn:active { transform: scale(0.98); }
.analyze-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.result-section {
  margin-top: 24px;
}

.score-card {
  text-align: center;
  padding: 30px 0;
}

.score-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 6px solid var(--accent);
  margin: 0 auto;
}

.score-circle span {
  font-size: 42px;
  font-weight: 800;
  color: var(--text);
}

.score-label {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.components {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}

.components h3 {
  font-size: 14px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bar-row > span:first-child {
  width: 120px;
  font-size: 14px;
  color: var(--text-dim);
}

.bar-bg {
  flex: 1;
  height: 10px;
  background: var(--surface2);
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .6s ease;
}

.bar-row > span:last-child {
  width: 30px;
  text-align: right;
  font-size: 14px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.explanation-box, .rewrite-box, .cultural-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent3);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
}

.rewrite-box { border-left-color: var(--accent2); }
.cultural-box { border-left-color: var(--accent4); }

.explanation-box h3, .rewrite-box h3, .cultural-box h3 {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.explanation-box p, .rewrite-box p, .cultural-box p {
  font-size: 15px;
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}

.action-btn {
  flex: 1;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}

.action-btn:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.try-cta {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
  text-align: center;
  animation: pulse 2s ease-in-out;
}

.try-cta-text {
  font-size: 15px;
  color: var(--text);
  margin: 0 0 12px 0;
}

.try-cta-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.try-cta-btn:hover {
  opacity: 0.85;
  transform: scale(1.03);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.upgrade-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 24px;
}

.upgrade-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.upgrade-section > p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 16px;
}

.payment-box {
  background: var(--surface2);
  border-radius: 8px;
  padding: 16px;
}

.wallet-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wallet-label {
  background: var(--accent2);
  color: #000;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.wallet-addr {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  flex: 1;
}

.copy-addr {
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.copy-addr:hover { color: var(--text); }

.payment-note {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 10px;
}

.tx-verify {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.tx-input {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--mono);
}

.tx-input:focus {
  outline: none;
  border-color: var(--accent);
}

.verify-btn {
  background: var(--accent2);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s;
}

.verify-btn:hover { opacity: 0.9; }
.verify-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.verify-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.verify-result.success {
  background: rgba(46, 204, 113, 0.15);
  color: var(--accent2);
  border: 1px solid var(--accent2);
}

.verify-result.error {
  background: rgba(231, 76, 60, 0.15);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.loading {
  text-align: center;
  padding: 30px;
  color: var(--text-dim);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.privacy {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 30px;
  padding: 0 20px;
}

footer {
  text-align: center;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 30px;
}

footer p {
  font-size: 12px;
  color: var(--text-dim);
}

.hidden { display: none !important; }

@media (max-width: 600px) {
  h1 { font-size: 28px; }
  .bar-row > span:first-child { width: 80px; font-size: 12px; }
  .actions { flex-direction: column; }
  .wallet-info { flex-direction: column; align-items: flex-start; }
  .wallet-addr { width: 100%; }
}
