@import url("https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Space+Grotesk:wght@400;600&display=swap");

:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #53657e;
  --brand: #1e3a8a;
  --brand-dark: #152a66;
  --brand-soft: #e4ebf8;
  --surface: #f6f8fc;
  --surface-strong: #e9eef8;
  --accent: #c76a14;
  --accent-dark: #8f4c0f;
  --accent-soft: #fff0d8;
  --border: #c9d5ea;
  --success: #15803d;
  --danger: #b4232d;
  font-family: "DM Serif Display", "Georgia", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(135deg, #f8fafc 0%, #eef3fb 52%, #fff7ed 100%);
  min-height: 100vh;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: var(--brand);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand__logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 8px 16px rgba(40, 20, 5, 0.18);
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.brand__title {
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  color: #f8fbff;
}

.brand__subtitle {
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: #d6e3ff;
  font-size: 0.9rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  color: var(--muted);
  font: 600 0.82rem "Space Grotesk", "Trebuchet MS", sans-serif;
  line-height: 1.3;
  text-align: left;
}

.breadcrumbs a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs > * {
  display: inline-flex;
  align-items: center;
}

.breadcrumbs > * + *::before {
  content: ">";
  margin-right: 0.35rem;
  color: #7a879a;
}

.breadcrumbs [aria-current="page"] {
  color: var(--ink);
}

.keybox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: #e9eefb;
}

.keybox input {
  padding: 0.5rem 0.75rem;
  min-width: 220px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}

button {
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(40, 20, 5, 0.12);
}

.hint {
  font-size: 0.85rem;
  color: #d7e0f4;
}

.shell {
  padding: clamp(2.5rem, 6vw, 5.5rem) 2rem clamp(3rem, 7vw, 5rem);
  max-width: 1260px;
  margin: 0 auto;
}

.subject-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2.25rem, 7vw, 6.5rem);
  align-items: stretch;
}

.subject {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(2.1rem, 4vw, 2.8rem);
  align-content: stretch;
}

.subject__tab {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 1.35rem 1.5rem 1.05rem;
  width: min(100%, 378px);
  min-height: 82px;
  border-radius: 0.65rem;
  background: var(--brand);
  color: #fff;
  text-align: center;
  font: 600 clamp(1.18rem, 2vw, 1.35rem) "Space Grotesk", "Trebuchet MS", sans-serif;
}

.subject__icon {
  position: absolute;
  top: -42px;
  left: clamp(1rem, 4vw, 2.35rem);
  width: 96px;
  height: 96px;
  transform: rotate(-8deg);
  transform-origin: center;
  pointer-events: none;
}

.subject:nth-child(2) .subject__icon {
  right: clamp(1rem, 4vw, 2.35rem);
  left: auto;
  transform: rotate(8deg);
}

.module-grid {
  display: grid;
  justify-items: center;
  align-content: flex-start;
  grid-template-rows: repeat(3, minmax(154px, 1fr));
  gap: clamp(0.85rem, 1.5vw, 1.15rem);
  height: 100%;
}

.module {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.45rem;
  width: min(100%, 378px);
  height: 100%;
  min-height: 154px;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid #b8c7df;
  border-radius: 0.7rem;
  background: var(--surface-strong);
  color: var(--ink);
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.module__heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.module__icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 14px;
}

.module__title {
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  font-weight: 600;
  line-height: 1.2;
}

.module__description {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.module--live:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(40, 20, 5, 0.12);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.module--live:hover .module__description {
  color: #5f4321;
}

.module:disabled {
  border-color: #d7dee9;
  background: #edf1f7;
  color: #7e8ba0;
  cursor: not-allowed;
  opacity: 0.72;
}

.module:disabled:hover {
  transform: none;
  box-shadow: none;
}

.site-footer {
  padding: 1.35rem 1rem 1.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--brand);
  color: #e9eefb;
}

.storage-warning {
  margin: 0 auto;
  padding: 0 1.5rem;
  max-width: 720px;
  color: #ffd8d8;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  font-size: 0.95rem;
  text-align: center;
}

.footer-note {
  margin: 0.75rem auto 0;
  padding: 0 1.5rem;
  max-width: 720px;
  text-align: center;
  color: #d7e0f4;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  font-size: 0.95rem;
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin: 1.15rem auto 0;
  padding: 0 1rem;
}

.footer-tool-button {
  min-width: 104px;
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
}

.footer-tool-button:hover {
  border-color: #ffe4be;
  background: rgba(255, 228, 190, 0.18);
}

.footer-tool-button--danger {
  color: #ffd8d8;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: #ffe4be;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.link-button:hover {
  box-shadow: none;
  color: #fff7ed;
  transform: none;
}

.help-steps {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.help-warning {
  margin: 0.8rem 0 0;
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  background: #fff1f2;
  border: 1px solid #f5b5bf;
  color: #8a1d2c;
}


.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 42, 102, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 20;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #fbfcff;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.2rem;
  width: min(720px, 100%);
  box-shadow: 0 20px 40px rgba(21, 42, 102, 0.18);
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal__close {
  border-color: var(--border);
  background: #fff;
}

.modal__warning {
  background: #fff1f2;
  border: 1px solid #f5b5bf;
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  color: #8a1d2c;
  margin: 0.8rem 0;
}

.modal__warning.hidden {
  display: none;
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-top: 0.8rem;
}

.data-tools-modal {
  max-height: min(760px, calc(100vh - 3rem));
  overflow: auto;
}

.data-tools-copy {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.data-tools-textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: #fff;
  color: var(--ink);
  font: 0.88rem/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.data-tools-status {
  min-height: 1.35rem;
  margin: 0.7rem 0 0;
  color: var(--success);
  font-size: 0.92rem;
  font-weight: 600;
}

.data-tools-status.is-error {
  color: var(--danger);
}

.data-tools-actions {
  align-items: center;
}

.danger-button {
  border-color: #f5b5bf;
  background: #fff1f2;
  color: var(--danger);
  font-weight: 600;
}

.danger-button:hover {
  border-color: var(--danger);
  background: #ffe3e8;
}

@media (max-width: 860px) {
  .subject-columns {
    grid-template-columns: 1fr;
    gap: 3.5rem;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 1.2rem;
  }

  .keybox input {
    min-width: min(220px, 100%);
  }

  .shell {
    padding: 2.2rem 1rem 2.8rem;
  }

  .brand__title {
    font-size: 1.3rem;
  }

  .subject {
    gap: 1.65rem;
  }
}

@media (max-width: 480px) {
  .module {
    min-width: calc(50% - 0.45rem);
    padding: 0.9rem 0.5rem;
  }
}
