:root {
  --bg: #f5f6f2;
  --surface: #ffffff;
  --ink: #1f2a2a;
  --muted: #66726f;
  --line: #d9ded7;
  --accent: #b51f2a;
  --accent-dark: #861822;
  --green: #2d6b57;
  --blue: #315b88;
  --gold: #b8842b;
  --shadow: 0 18px 45px rgba(27, 39, 39, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(181, 31, 42, 0.08), transparent 32%),
    linear-gradient(225deg, rgba(45, 107, 87, 0.09), transparent 36%),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-logo {
  display: block;
  width: 100px;
  height: 100px;
  object-fit: contain;
}

.ghost-link,
.ghost-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}

.ghost-link {
  padding: 9px 12px;
  font-weight: 700;
}

.entry-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1fr);
  gap: 28px;
  align-items: stretch;
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 92px);
  margin: 0 auto;
  padding: 32px 0 54px;
}

.intro-panel {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-radius: 8px;
  padding: 36px;
  color: #fff;
  background:
    linear-gradient(rgba(31, 42, 42, 0.2), rgba(31, 42, 42, 0.54)),
    url("/resources/image.png?v=4")
      center/cover;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-panel .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 3.8rem;
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 24px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.count-meter {
  display: grid;
  gap: 14px;
  width: min(100%, 320px);
  font-size: 2rem;
  font-weight: 850;
}

.meter-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.meter-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  transition: width 180ms ease;
}

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

.intro-panel .muted {
  color: rgba(255, 255, 255, 0.68);
}

.tool-panel {
  border: 1px solid rgba(217, 222, 215, 0.9);
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.tool-panel.narrow {
  width: min(440px, 100%);
  margin: 70px auto 0;
}

.dream-form {
  display: grid;
  gap: 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 246, 242, 0.9);
}

.mode-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.mode-switch label {
  display: grid;
  gap: 4px;
  min-height: 74px;
  align-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.mode-switch label span {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 850;
}

.mode-switch label small {
  line-height: 1.25;
}

.mode-switch input:checked + label {
  border-color: rgba(181, 31, 42, 0.26);
  background: #fff;
  box-shadow: 0 4px 14px rgba(27, 39, 39, 0.08);
}

label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input {
  min-height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 260px;
  resize: vertical;
  padding: 14px;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 91, 136, 0.16);
}

.textarea-heading,
.panel-head,
.synthesis-head,
.dashboard-head,
.admin-actions,
.panel-actions,
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-footer {
  min-height: 48px;
  align-items: flex-end;
}

.status-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.status-message.error {
  color: var(--accent-dark);
}

.status-message.success {
  color: var(--green);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.primary-button {
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
}

.ghost-button {
  padding: 0 14px;
}

.danger-button {
  border: 1px solid rgba(181, 31, 42, 0.24);
  padding: 0 12px;
  color: var(--accent-dark);
  background: rgba(181, 31, 42, 0.07);
}

.danger-button:hover {
  border-color: rgba(181, 31, 42, 0.4);
  background: rgba(181, 31, 42, 0.12);
}

.icon-button {
  width: 42px;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.icon-button.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(181, 31, 42, 0.12);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  flex: 0 0 18px;
}

.admin-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 54px;
}

.hidden {
  display: none !important;
}

.dashboard {
  display: grid;
  gap: 20px;
}

.dashboard-head h1 {
  font-size: 2.55rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-strip > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.78);
}

.summary-strip span:first-child {
  font-size: 1.7rem;
  font-weight: 900;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(360px, 1.15fr);
  gap: 20px;
  align-items: start;
}

.dream-list,
.idea-list {
  display: grid;
  gap: 12px;
}

.dream-item,
.idea-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.dream-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.dream-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.delete-dream-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.delete-dream-button:hover {
  border-color: rgba(181, 31, 42, 0.24);
  color: var(--accent-dark);
  background: rgba(181, 31, 42, 0.07);
}

.delete-dream-button svg {
  width: 17px;
  height: 17px;
}

.dream-item p,
.idea-item p {
  margin-bottom: 0;
  line-height: 1.48;
}

.idea-item {
  display: grid;
  gap: 10px;
}

.idea-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.idea-item h3 {
  margin: 0;
  font-size: 1.05rem;
}

.copy-button {
  width: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
}

@media (max-width: 840px) {
  .entry-layout,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .entry-layout {
    padding-top: 14px;
  }

  .intro-panel {
    min-height: 330px;
  }

  h1 {
    font-size: 2.7rem;
  }

  .dashboard-head,
  .admin-actions,
  .panel-actions,
  .form-footer,
  .synthesis-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-actions,
  .panel-actions,
  .form-footer {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .ghost-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .topbar,
  .entry-layout,
  .admin-layout {
    width: min(100% - 20px, 1120px);
  }

  .tool-panel,
  .intro-panel {
    padding: 22px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    grid-template-columns: 1fr;
  }
}
