:root {
  --bg: #f4efe6;
  --panel: #fffaf0;
  --ink: #25201c;
  --muted: #71685f;
  --line: rgba(37, 32, 28, 0.14);
  --accent: #9b7442;
  --accent-dark: #735530;
  --note: #fff1a8;
  --note-shadow: rgba(74, 58, 38, 0.22);
  --shadow: 0 22px 52px rgba(42, 34, 26, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(155, 116, 66, 0.10), transparent 36%),
    var(--bg);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.86);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Yu Mincho", serif;
  font-size: clamp(2rem, 4vw, 3.7rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.add-note-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 148px;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: #fffaf0;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.add-note-button span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(255, 250, 240, 0.5);
  border-radius: 50%;
  line-height: 1;
}

.add-note-button:hover,
.add-note-button:focus-visible {
  transform: translateY(-2px);
  background: var(--accent-dark);
  box-shadow: 0 18px 44px rgba(42, 34, 26, 0.18);
}

.board-wrap {
  min-width: 0;
  padding: clamp(16px, 3vw, 34px);
}

.board {
  position: relative;
  min-height: calc(100vh - 150px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(rgba(37, 32, 28, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 32, 28, 0.045) 1px, transparent 1px),
    rgba(255, 250, 240, 0.58);
  background-size: 32px 32px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), var(--shadow);
  touch-action: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.empty-state p {
  margin: 0;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
}

.empty-state span {
  font-size: 0.92rem;
}

.empty-state.is-hidden {
  display: none;
}

.note {
  position: absolute;
  width: 260px;
  min-height: 210px;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid rgba(37, 32, 28, 0.10);
  border-radius: 14px;
  background: var(--note);
  box-shadow: 0 18px 30px var(--note-shadow);
  transform: rotate(var(--tilt, -1deg));
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.note:hover,
.note.is-dragging {
  box-shadow: 0 26px 46px rgba(74, 58, 38, 0.28);
  transform: rotate(0deg) translateY(-2px);
}

.note.is-dragging {
  z-index: 20;
  cursor: grabbing;
  user-select: none;
}

.note-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 4px;
}

.note-toolbar button {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(37, 32, 28, 0.12);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.52);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.note-toolbar button:hover,
.note-toolbar button:focus-visible {
  background: rgba(255, 250, 240, 0.86);
  transform: translateY(-1px);
}

.note-drag {
  cursor: grab;
  touch-action: none;
}

.note-delete {
  color: #594330;
}

.note-text {
  width: 100%;
  min-height: 154px;
  padding: 8px 16px 18px;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--ink);
  background: transparent;
  font-size: 1rem;
  line-height: 1.75;
}

.note-text::placeholder {
  color: rgba(37, 32, 28, 0.42);
}

@media (min-width: 1280px) {
  .note {
    width: 280px;
    min-height: 220px;
  }
}

@media (max-width: 900px) {
  .app-header {
    padding: 22px 24px;
  }

  .board {
    min-height: calc(100vh - 136px);
    border-radius: 20px;
  }

  .note {
    width: 236px;
    min-height: 200px;
  }
}

@media (max-width: 520px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    padding: 20px 16px;
  }

  .add-note-button {
    width: 100%;
    min-height: 54px;
  }

  .board-wrap {
    padding: 12px;
  }

  .board {
    min-height: calc(100vh - 178px);
    border-radius: 18px;
    background-size: 28px 28px;
  }

  .note {
    width: min(292px, calc(100vw - 48px));
    min-height: 196px;
    border-radius: 16px;
  }

  .note-toolbar button {
    min-height: 44px;
    padding-inline: 14px;
  }

  .note-text {
    min-height: 138px;
    font-size: 1rem;
  }
}
