:root {
  --bg-top: #f5e6dc;
  --bg-bottom: #e8d4c4;
  --paper: rgba(255, 248, 243, 0.94);
  --paper-strong: #fff9f5;
  --sand: #e6d2c2;
  --sand-dark: #c9a88e;
  --line: rgba(139, 69, 49, 0.16);
  --line-strong: rgba(139, 69, 49, 0.26);
  --ink: #3d2418;
  --muted: #8b5a4a;
  --canyon: #c45a3a;
  --sage: #7a8a5a;
  --terracotta: #b84a30;
  --rust: #a63d2a;
  --mesa: #d46a42;
  --sunset: #e07848;
  --shadow-lg: 0 24px 56px rgba(139, 54, 38, 0.14);
  --shadow-md: 0 12px 28px rgba(139, 54, 38, 0.10);
  --shadow-sm: 0 6px 16px rgba(139, 54, 38, 0.07);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(196, 90, 58, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(180, 74, 48, 0.12), transparent 40%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background:
    repeating-radial-gradient(circle at 15% 12%, rgba(146, 101, 73, 0.08) 0 1px, transparent 1px 18px),
    repeating-radial-gradient(circle at 84% 22%, rgba(146, 101, 73, 0.06) 0 1px, transparent 1px 20px);
}

button,
input,
select,
textarea {
  font: inherit;
}

header,
main {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

header {
  padding: 28px 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

header h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--terracotta);
}

.subtitle {
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}

header button {
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 250, 245, 0.9);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

header button:hover {
  transform: translateY(-1px);
  background: var(--paper-strong);
  box-shadow: var(--shadow-md);
}

main {
  padding-bottom: 36px;
}

.board {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.board-header {
  display: grid;
  grid-template-columns: 62px repeat(4, 1fr);
  background: linear-gradient(180deg, rgba(220, 185, 165, 0.85), rgba(245, 232, 222, 0.96));
  border-bottom: 1px solid var(--line);
}

.board-header .slot-label {
  padding: 14px;
}

.day-label {
  padding: 16px 18px;
  font-family: "Fraunces", serif;
  font-size: 21px;
  font-weight: 600;
  text-align: center;
  color: var(--rust);
  border-left: 1px solid var(--line);
}

.board-row {
  display: grid;
  grid-template-columns: 62px repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.board-row:last-child {
  border-bottom: none;
}

.slot-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--rust);
  background: linear-gradient(180deg, rgba(228, 200, 180, 0.78), rgba(245, 235, 228, 0.9));
}

.slot-label-header {
  color: transparent;
}

.block-cell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  padding: 10px;
  border-left: 1px solid var(--line);
  min-height: 220px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0)),
    rgba(255, 251, 247, 0.7);
}

.entry {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 250, 245, 0.82);
  border: 1px solid rgba(126, 95, 74, 0.08);
  border-left: 3px solid #ccc;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry:hover {
  transform: translateY(-1px);
  background: var(--paper-strong);
  box-shadow: var(--shadow-sm);
}

.entry.filled {
  background: var(--paper-strong);
  box-shadow: var(--shadow-sm);
}

.entry.empty {
  border-style: dashed;
  border-left-style: solid;
}

.entry.editing {
  background: var(--paper-strong);
  border: 2px solid;
  cursor: default;
  grid-column: span 2;
  grid-row: span 2;
  box-shadow: var(--shadow-md);
}

.entry.editing:hover {
  transform: none;
}

.entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.person-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.12);
}

.person-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.type-badge {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  color: white;
  font-weight: 700;
  margin-left: auto;
  letter-spacing: 0.04em;
}

.entry-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.entry-placeholder {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.type-input,
.what-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 13px;
  background: #fffdfa;
  color: var(--ink);
}

.what-input {
  flex: 1;
  resize: none;
  min-height: 96px;
}

.what-input:focus,
.type-input:focus {
  outline: none;
  border-color: rgba(161, 78, 53, 0.5);
  box-shadow: 0 0 0 3px rgba(161, 78, 53, 0.08);
}

.edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-save,
.btn-cancel {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

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

.btn-save {
  background: var(--terracotta);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-save:hover {
  background: var(--rust);
}

.btn-cancel {
  background: rgba(239, 228, 217, 0.92);
  color: var(--ink);
}

.btn-cancel:hover {
  background: rgba(229, 214, 201, 0.98);
}

@media (max-width: 1000px) {
  .block-cell {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, auto);
    min-height: auto;
  }

  .entry.editing {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 760px) {
  header,
  main {
    width: min(100% - 20px, 1280px);
  }

  header {
    padding-top: 20px;
    flex-direction: column;
    align-items: stretch;
  }

  .board-header,
  .board-row {
    grid-template-columns: 46px repeat(4, 1fr);
  }

  .day-label {
    padding: 12px 8px;
    font-size: 17px;
  }

  .slot-label {
    font-size: 20px;
  }

  .block-cell {
    padding: 6px;
    gap: 6px;
  }

  .entry {
    padding: 9px;
  }

  .person-dot {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .type-badge {
    padding: 3px 6px;
  }
}
