:root {
  --bg: #f7f1e8;
  --bg-soft: #fdfaf6;
  --surface: #fffaf4;
  --surface-strong: #ffffff;
  --ink: #2b2724;
  --ink-soft: #635b55;
  --line: #eadfce;
  --brand: #be5c37;
  --brand-strong: #a54e2d;
  --accent: #336a62;
  --danger: #b63c33;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-lg: 0 18px 45px rgba(38, 27, 18, 0.14);
  --shadow-md: 0 10px 28px rgba(45, 30, 18, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, #fff2de 0, transparent 42%),
    radial-gradient(circle at 85% 80%, #e5f2e8 0, transparent 40%),
    linear-gradient(165deg, var(--bg), #f3ece2 60%, #efe5d8);
}

h1,
h2,
h3 {
  font-family: 'Fraunces', serif;
  letter-spacing: 0.01em;
  margin: 0;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.73rem;
  font-weight: 700;
  color: #7d7268;
  margin: 0 0 8px;
}

.hidden {
  display: none !important;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.btn:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #6c9a91;
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(130deg, var(--brand), #d5724a);
  color: #fff;
  box-shadow: 0 8px 18px rgba(190, 92, 55, 0.26);
}

.btn-primary:hover {
  background: linear-gradient(130deg, var(--brand-strong), var(--brand));
}

.btn-secondary {
  background: #efe6dc;
  color: #463d37;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #d8cab7;
  color: #5a524c;
}

.btn-danger {
  background: #f8e8e6;
  color: var(--danger);
}

.btn-large {
  padding: 14px 20px;
  font-size: 1.02rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid #ddcfbf;
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.app-shell {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.login-ornament {
  position: absolute;
  border-radius: 999px;
  filter: blur(0.5px);
  opacity: 0.62;
}

.login-ornament-a {
  width: 340px;
  height: 340px;
  background: #ffe0b8;
  left: -120px;
  top: -120px;
}

.login-ornament-b {
  width: 390px;
  height: 390px;
  background: #d8ece2;
  right: -150px;
  bottom: -170px;
}

.login-panel {
  position: relative;
  width: min(100%, 460px);
  background: rgba(255, 250, 244, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 30px 22px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.login-title {
  font-size: clamp(2rem, 9vw, 2.9rem);
  margin-bottom: 10px;
}

.login-subtitle {
  margin: 0 0 24px;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  font-weight: 600;
  color: #4f4741;
}

.login-panel.login-failure {
  animation: softShake 0.34s ease;
}

@keyframes softShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

.board-view {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 16px 42px;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.board-title {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
}

.board-header-actions {
  display: flex;
  gap: 8px;
}

.toast {
  position: sticky;
  top: 14px;
  margin: 0 0 14px auto;
  width: fit-content;
  max-width: min(100%, 360px);
  background: #f2fbf6;
  border: 1px solid #c6e8d5;
  color: #1f5143;
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.cards {
  display: grid;
  gap: 14px;
}

.story-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-strong));
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.story-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(150deg, #f4ece4, #ece6de);
}

.story-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8e847b;
  text-align: center;
  padding: 8px;
  font-size: 0.96rem;
}

.story-content {
  padding: 14px;
}

.story-title {
  font-size: 1.4rem;
}

.story-body {
  margin: 8px 0 0;
  color: var(--ink-soft);
  white-space: pre-wrap;
  line-height: 1.5;
}

.story-actions,
.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.card-edit-form {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  background: #fff;
  border: 1px solid #e8ddce;
  padding: 12px;
  border-radius: 14px;
}

.card-edit-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #4d433d;
}

.card-feedback {
  min-height: 1.25em;
  margin: 0;
  font-size: 0.95rem;
  color: #5f5650;
}

.empty-state {
  text-align: center;
  margin-top: 12px;
  background: rgba(255, 251, 246, 0.78);
  border: 1px dashed #d8c9b5;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 30px 16px;
}

.empty-state h3 {
  font-size: 1.6rem;
}

.empty-state p {
  margin: 8px auto 16px;
  max-width: 560px;
  color: var(--ink-soft);
}

@media (min-width: 760px) {
  .board-view {
    padding: 28px 20px 54px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .story-content {
    padding: 16px;
  }
}

@media (min-width: 1040px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
