:root {
  --bg: #050508;
  --surface: #0c0a12;
  --surface2: #12101a;
  --border: rgba(177, 80, 144, 0.35);
  --magenta: #b15090;
  --cyan: #00d4ff;
  --text: #f0eaf5;
  --muted: rgba(240, 234, 245, 0.5);
  --online: #3ddc84;
  --mono: 'Space Mono', ui-monospace, monospace;
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}

a { color: var(--cyan); text-decoration: none; }

.shell {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 32px;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.miku-hero {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto 18px;
}

.miku-hero-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--cyan), var(--magenta), #ff2d9a, var(--cyan));
  animation: miku-ring-spin 12s linear infinite;
  opacity: 0.85;
  filter: blur(0.5px);
}

.miku-hero-ring::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--bg);
}

.miku-hero-img {
  position: relative;
  z-index: 1;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 40px rgba(177, 80, 144, 0.45),
    0 0 24px rgba(0, 212, 255, 0.2),
    inset 0 0 20px rgba(0, 0, 0, 0.4);
}

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

.epithet {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--magenta);
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(177, 80, 144, 0.35);
}

.tagline {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.sub {
  font-size: 12px;
  color: var(--muted);
  max-width: 420px;
  margin: 0 auto;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.online { background: var(--online); box-shadow: 0 0 8px var(--online); }
.status-dot.offline { background: #666; }

.status-core {
  color: var(--magenta);
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

body[data-core="creative"] .status-core { color: var(--cyan); }
body[data-core="creative"] .miku-hero-ring {
  background: conic-gradient(from 120deg, var(--cyan), #7b5cff, var(--magenta), var(--cyan));
}

.terminal {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  min-height: 420px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.term-header {
  padding: 8px 14px;
  background: rgba(177, 80, 144, 0.15);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.15em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.core-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.core-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.core-btn:hover { color: var(--text); }

.core-btn.active {
  background: rgba(177, 80, 144, 0.35);
  color: var(--text);
}

body[data-core="creative"] .core-btn.active {
  background: rgba(0, 212, 255, 0.2);
  color: var(--cyan);
}

.term-badge {
  color: var(--muted);
  white-space: nowrap;
}

body[data-core="creative"] .term-header {
  background: rgba(0, 212, 255, 0.08);
}

.term-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-miku { color: var(--muted); }
.msg-miku .who { color: var(--magenta); font-weight: 700; }
.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  flex-shrink: 0;
  border: 1px solid rgba(177, 80, 144, 0.5);
  box-shadow: 0 0 10px rgba(177, 80, 144, 0.25);
}
.msg-body { flex: 1; min-width: 0; }
.msg-user { color: var(--text); }
.msg-user .who { color: var(--cyan); font-weight: 700; }
.msg-sys { font-size: 11px; color: var(--muted); font-style: italic; }

.term-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: #08060c;
}

.term-input textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
}

.term-input button {
  background: var(--magenta);
  color: #fff;
  border: none;
  padding: 0 18px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 4px;
}

.term-input button:disabled { opacity: 0.45; cursor: not-allowed; }

.footer {
  margin-top: 20px;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.quota {
  font-size: 10px;
  color: var(--muted);
  padding: 0 14px 8px;
  text-align: right;
}
