*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #e6edf3;
}

/* Cards */
.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  margin-bottom: 1.5rem;
}

.card.centered {
  text-align: center;
  max-width: 400px;
  margin: 4rem auto;
}

.card h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #e6edf3;
}

/* Auth states */
.auth-state { }
.hidden { display: none !important; }

.muted {
  color: #8b949e;
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #238636;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #2ea043;
}

.btn-secondary {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
}

.btn-secondary:hover:not(:disabled) {
  background: #30363d;
  color: #e6edf3;
}

/* Profile card */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-identity {
  flex: 1;
  min-width: 0;
}

.profile-identity h2 {
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  flex-shrink: 0;
}

/* Prompt card */
.prompt-card h2 {
  margin-bottom: 1rem;
}

.prompt-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.prompt-textarea {
  flex: 1;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: #e6edf3;
  resize: vertical;
  transition: border-color 0.15s;
}

.prompt-textarea::placeholder {
  color: #484f58;
}

.prompt-textarea:focus {
  outline: none;
  border-color: #388bfd;
}

.generate-btn {
  flex-shrink: 0;
  align-self: flex-end;
}

.prompt-status {
  margin-top: 0.75rem;
  color: #8b949e;
  font-size: 0.9rem;
  font-style: italic;
}

/* Plot cards */
.plot-card {
  padding: 0;
  overflow: hidden;
}

.plot-meta {
  padding: 0.75rem 1rem 0.5rem;
  border-bottom: 1px solid #30363d;
}

.plot-prompt-text {
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.plot-iframe {
  display: block;
  width: 100%;
  height: 500px;
  border: none;
  background: #fff;
}

.plot-actions {
  padding: 0.6rem 1rem;
  border-top: 1px solid #30363d;
  display: flex;
  gap: 0.5rem;
}

/* Debug panel */
.debug-panel {
  border-top: 1px solid #30363d;
  background: #0d1117;
  padding: 0.75rem 1rem;
}

.debug-content {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #8b949e;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* Update form */
.update-form {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid #30363d;
  background: #0d1117;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.update-textarea {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: #e6edf3;
  resize: vertical;
  transition: border-color 0.15s;
}

.update-textarea::placeholder {
  color: #484f58;
}

.update-textarea:focus {
  outline: none;
  border-color: #388bfd;
}

.update-form-actions {
  display: flex;
  gap: 0.5rem;
}

.update-status {
  color: #8b949e;
  font-size: 0.85rem;
  font-style: italic;
}

/* Error banner */
.error-banner {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #2d1117;
  border: 1px solid #6e2c2c;
  border-radius: 8px;
  color: #f85149;
  font-size: 0.875rem;
}

@media (max-width: 480px) {
  .prompt-input-row {
    flex-direction: column;
  }

  .prompt-textarea {
    width: 100%;
  }

  .generate-btn {
    align-self: stretch;
    text-align: center;
  }

  .plot-iframe {
    height: 360px;
  }
}


