:root {
  --bg: #0a0a0a;
  --bg-panel: #111;
  --bg-card: #1a1a1a;
  --fg: #e0e0e0;
  --fg-dim: #888;
  --accent: #00ff41;
  --accent-dim: #008822;
  --gold: #d4af37;
  --red: #c41e3a;
  --border: #222;
  --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'JetBrains Mono', 'Consolas', monospace;
  --font-serif: 'Georgia', 'Songti SC', 'STSong', serif;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
}

/* ─── Scanline overlay ─── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 65, 0.015) 2px,
    rgba(0, 255, 65, 0.015) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* ─── Container ─── */
#app {
  width: 100%;
  max-width: 640px;
  position: relative;
  z-index: 2;
}

/* ─── Header ─── */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.header h1 {
  font-size: 1.6rem;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.header .subtitle {
  color: var(--fg-dim);
  font-size: 0.85rem;
}

/* ─── Lang toggle ─── */
.lang-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 4px;
  font-size: 0.8rem;
}

.lang-toggle button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.2s;
}

.lang-toggle button.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Fortune stick container ─── */
.fortune-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 40px 32px;
  text-align: center;
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ─── Shake button ─── */
.shake-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 16px 48px;
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.shake-btn:hover {
  background: rgba(0, 255, 65, 0.1);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.2);
}

.shake-btn:active {
  transform: scale(0.98);
}

.shake-btn.shaking {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-2deg); }
  40% { transform: translateX(8px) rotate(2deg); }
  60% { transform: translateX(-6px) rotate(-1deg); }
  80% { transform: translateX(6px) rotate(1deg); }
}

/* ─── Fortune result ─── */
.fortune-result {
  display: none;
  animation: fadeIn 0.5s ease;
}

.fortune-result.visible {
  display: block;
}

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

.fortune-number {
  color: var(--fg-dim);
  font-size: 0.75rem;
  letter-spacing: 3px;
  margin-bottom: 20px;
}

.fortune-text {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--fg);
  margin-bottom: 24px;
  max-width: 480px;
  min-height: 60px;
}

.fortune-lucky, .fortune-unlucky {
  font-size: 0.85rem;
  margin: 6px 0;
  text-align: left;
  width: 100%;
  max-width: 400px;
}

.fortune-lucky {
  color: var(--accent);
}

.fortune-unlucky {
  color: var(--red);
}

.fortune-lucky::before {
  content: '> ';
}

.fortune-unlucky::before {
  content: '> ';
}

/* ZH mode: labels are in HTML, no CSS ::before needed */
body.zh-mode {
  --accent: var(--gold);
  --bg: #1a0a0a;
  --bg-card: #2a1010;
  --border: #3a2020;
}

body.zh-mode .header h1 {
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

body.zh-mode .fortune-text {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 1.8;
}

body.zh-mode .shake-btn {
  border-color: var(--gold);
  color: var(--gold);
}

body.zh-mode .shake-btn:hover {
  background: rgba(212, 175, 55, 0.1);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

body.zh-mode .lang-toggle button.active {
  border-color: var(--gold);
  color: var(--gold);
}

body.zh-mode::before {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(212, 175, 55, 0.015) 2px,
    rgba(212, 175, 55, 0.015) 4px
  );
}

/* ─── Action buttons ─── */
.actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

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

/* ─── Oracle section ─── */
.oracle-section {
  margin-top: 32px;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  text-align: center;
}

.oracle-title {
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.oracle-desc {
  color: var(--fg-dim);
  font-size: 0.8rem;
  margin-bottom: 16px;
}

.oracle-input {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.oracle-input:focus {
  outline: none;
  border-color: var(--gold);
}

.oracle-btn {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 8px 24px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.oracle-btn:hover {
  background: rgba(212, 175, 55, 0.1);
}

.oracle-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Payment section ─── */
.payment-section {
  display: none;
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
}

.payment-section.visible {
  display: block;
}

.payment-title {
  color: var(--gold);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.wallet-address {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg);
  background: var(--bg);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  word-break: break-all;
  margin: 8px 0;
  cursor: pointer;
  transition: border-color 0.2s;
}

.wallet-address:hover {
  border-color: var(--gold);
}

.payment-amount {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: bold;
  margin: 8px 0;
}

.payment-hint {
  color: var(--fg-dim);
  font-size: 0.75rem;
  margin-top: 8px;
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  margin-top: 40px;
  color: var(--fg-dim);
  font-size: 0.75rem;
  line-height: 1.6;
}

.footer a {
  color: var(--fg-dim);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.footer a:hover {
  color: var(--accent);
}

.footer .curl-hint {
  margin-top: 12px;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  display: inline-block;
  font-family: var(--font-mono);
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .header h1 { font-size: 1.3rem; }
  .fortune-text { font-size: 1rem; }
  .fortune-container { padding: 24px 16px; }
}

/* ─── Popular fortunes grid ─── */
.popular-fortunes {
  margin-top: 24px;
}

.popular-title {
  color: var(--fg-dim);
  font-size: 0.75rem;
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-align: center;
}

.fortune-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-fortune {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 10px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.mini-fortune:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.mini-num {
  color: var(--fg-dim);
  font-size: 0.65rem;
  letter-spacing: 1px;
}

.mini-text {
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mini-lucky {
  font-size: 0.65rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .fortune-grid {
    grid-template-columns: 1fr;
  }
  .mini-text {
    -webkit-line-clamp: 2;
  }
}
