:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  --bg-deep-1: #0a241b;
  --bg-deep-2: #0e2e23;
  --bg-deep-3: #13382a;
  --text-main: #173628;
  --muted-text: #2f5f49;
  --card-bg: rgba(214, 245, 220, 0.9);
  --card-border: rgba(158, 222, 172, 0.7);
  --card-shadow: rgba(6, 28, 18, 0.35);
  --input-bg: rgba(241, 255, 245, 0.95);
  --input-border: #85bf96;
  --brand: #2b8750;
  --brand-2: #34684b;
  --brand-disabled: #80b591;
  --link: #1f7a45;
  --status-bg: rgba(220, 250, 228, 0.85);
  --status-text: #1e6a3e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 12% 10%, var(--bg-deep-3) 0%, var(--bg-deep-2) 42%, var(--bg-deep-1) 100%);
  color: var(--text-main);
  overflow-x: hidden;
}

#forestBg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container {
  width: min(960px, 92%);
  margin: 0 auto;
  padding: 32px 0 48px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 14px 34px var(--card-shadow);
  backdrop-filter: blur(6px);
  padding: 24px;
}

h1,
h2,
h3,
p,
label,
a,
button,
input,
textarea,
.status {
  overflow-wrap: anywhere;
  word-break: break-word;
}

h1 {
  margin: 0 0 14px;
  font-size: 28px;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

h3 {
  margin: 0 0 10px;
}

p {
  margin: 0 0 12px;
  line-height: 1.6;
}

.muted {
  color: var(--muted-text);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  outline: none;
  background: var(--input-bg);
  color: var(--text-main);
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(75, 181, 111, 0.32);
}

button {
  border: none;
  background: var(--brand);
  color: #ffffff;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

button.secondary {
  background: var(--brand-2);
}

button:disabled {
  background: var(--brand-disabled);
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar {
  justify-content: space-between;
  align-items: center;
}

.action-link {
  align-self: center;
  color: var(--link);
}

.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--status-bg);
  color: var(--status-text);
}

.error {
  background: rgba(251, 214, 214, 0.92);
  color: #8f2020;
}

.success {
  background: rgba(210, 247, 218, 0.92);
  color: #155f35;
}

.module-card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  background: rgba(228, 251, 233, 0.8);
}

.module-card a {
  display: inline-block;
  margin-top: 10px;
  text-decoration: none;
  color: var(--link);
  font-weight: 600;
}

.stream-box {
  width: 100%;
  min-height: 220px;
  margin-top: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
  background: #111827;
  color: #e5e7eb;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: hidden;
  font-size: 13px;
  display: none;
}

.link-list a {
  display: block;
  margin-top: 8px;
  color: var(--link);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .container {
    width: 100%;
    padding: 16px 12px 24px;
  }

  .card {
    border-radius: 12px;
    padding: 16px;
  }

  h1 {
    font-size: 22px;
    margin-bottom: 10px;
  }

  h2 {
    font-size: 18px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar button {
    width: 100%;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button,
  .actions a {
    width: 100%;
    text-align: center;
  }

  input,
  textarea,
  button,
  .status,
  .module-card {
    font-size: 16px;
  }
}
