:root {
  --paper: #ead9af;
  --paper-light: #f7edcf;
  --paper-deep: #d8bf83;
  --ink: #25170f;
  --ink-soft: #6f5639;
  --pin: #a57529;
  --pin-light: #e6c36d;
  --leather: #7e332b;
  --leather-dark: #3b1815;
  --edge: rgba(83, 52, 27, .28);
  --line: rgba(82, 52, 28, .13);
  --shadow: 0 12px 28px rgba(64, 39, 19, .16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #171715;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgba(94, 55, 25, .12), transparent 22%),
    radial-gradient(circle at 94% 4%, rgba(94, 55, 25, .1), transparent 20%),
    repeating-linear-gradient(0deg, transparent 0, transparent 36px, var(--line) 37px),
    linear-gradient(180deg, var(--paper-light), var(--paper) 42%, var(--paper-deep));
  font-family: "STKaiti", "KaiTi", "FangSong", "Noto Serif SC", "Iowan Old Style", serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  pointer-events: none;
  background:
    radial-gradient(circle at 16px 16px, var(--pin-light) 0 7px, #5e3516 8px, transparent 10px),
    radial-gradient(circle at calc(100% - 16px) 16px, var(--pin-light) 0 7px, #5e3516 8px, transparent 10px),
    linear-gradient(180deg, #20221f, #111312);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}

body::after {
  content: "";
  position: fixed;
  z-index: 1;
  top: 40px;
  right: 8px;
  width: 15px;
  height: 170px;
  pointer-events: none;
  background: rgba(74, 54, 34, .25);
  border: 1px solid rgba(255, 246, 219, .24);
  border-radius: 999px;
  box-shadow: inset 0 0 8px rgba(44, 28, 16, .2);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.grudge-back {
  position: fixed;
  z-index: 30;
  top: 18px;
  left: 20px;
  display: inline-grid;
  place-items: center;
  min-width: 66px;
  height: 38px;
  padding: 0 13px;
  color: #f8e7b4;
  text-decoration: none;
  background: linear-gradient(180deg, #30362f, #171b18);
  border: 1px solid rgba(232, 196, 111, .48);
  border-radius: 5px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .24);
  font-weight: 800;
}

.grudge-back:hover {
  border-color: var(--pin-light);
}

.grudge-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 76px clamp(16px, 2.5vw, 42px) 96px;
}

.grudge-shell::before {
  content: "";
  position: absolute;
  top: 30px;
  left: clamp(76px, 6vw, 112px);
  width: 76px;
  height: 112px;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 231, 175, .2), transparent 18%, transparent 82%, rgba(0, 0, 0, .18)),
    linear-gradient(180deg, var(--leather), var(--leather-dark));
  border: 1px solid rgba(255, 224, 151, .35);
  clip-path: polygon(0 0, 100% 0, 100% 82%, 50% 100%, 0 82%);
  box-shadow: 0 8px 20px rgba(58, 32, 20, .2);
}

.grudge-shell::after {
  content: "⚒";
  position: absolute;
  top: 43px;
  left: calc(clamp(76px, 6vw, 112px) + 21px);
  width: 34px;
  height: 44px;
  pointer-events: none;
  color: rgba(255, 239, 200, .82);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(38, 14, 10, .55);
  transform: rotate(-8deg);
}

.grudge-total {
  position: absolute;
  top: 60px;
  right: clamp(28px, 3vw, 54px);
  color: #3d2819;
  font-size: 16px;
  letter-spacing: 0;
}

.grudge-total strong {
  display: inline-block;
  min-width: 2ch;
  color: #8c2f25;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  text-align: center;
}

.grudge-mast {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto clamp(30px, 4vw, 48px);
  text-align: center;
}

.grudge-title h1 {
  margin: 0;
  color: #24150f;
  font-size: clamp(58px, 7.2vw, 104px);
  line-height: .94;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255, 247, 218, .78);
}

.grudge-title p {
  margin: 12px 0 0;
  color: #5d442f;
  font-size: clamp(16px, 1.45vw, 21px);
  line-height: 1.7;
}

#grudge-count {
  display: inline-block;
  min-width: 2ch;
  color: #8c2f25;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  text-align: center;
}

.grudge-search {
  position: relative;
  display: block;
  width: min(760px, 100%);
}

.grudge-search input {
  width: 100%;
  height: 68px;
  min-width: 0;
  padding: 0 22px 0 68px;
  color: var(--ink);
  background: rgba(255, 249, 229, .56);
  border: 1px solid rgba(76, 49, 27, .34);
  border-radius: 8px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 10px 20px rgba(84, 55, 30, .08);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.grudge-search::before {
  content: "⌕";
  position: absolute;
  z-index: 1;
  left: 24px;
  top: 18px;
  color: #5f3f29;
  font-size: 32px;
  line-height: 1;
}

.grudge-search input::placeholder {
  color: rgba(88, 62, 39, .58);
}

.grudge-search input:focus {
  border-color: var(--pin);
  background: rgba(255, 251, 235, .72);
  box-shadow: 0 0 0 3px rgba(170, 122, 45, .13), inset 0 0 0 1px rgba(255, 255, 255, .38);
}

.grudge-ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(26px, 3.6vw, 42px) clamp(28px, 4vw, 62px);
  max-width: 1320px;
  margin: 0 auto;
}

.grudge-card {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 42px 32px 20px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10px 10px, rgba(98, 64, 31, .16), transparent 18px),
    radial-gradient(circle at calc(100% - 8px) calc(100% - 8px), rgba(98, 64, 31, .14), transparent 18px),
    repeating-linear-gradient(0deg, transparent 0, transparent 39px, rgba(93, 58, 31, .09) 40px),
    linear-gradient(180deg, rgba(249, 238, 201, .84), rgba(226, 205, 158, .68));
  border: 1px solid rgba(92, 58, 32, .28);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.grudge-card-pin {
  position: absolute;
  top: 13px;
  left: 50%;
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 35% 30%, #f8dc8d, #ae792c 64%, #5a3517);
  border: 1px solid rgba(55, 33, 15, .54);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .24);
  transform: translateX(-50%);
}

.grudge-card h2 {
  margin: 0 0 18px;
  color: #21130e;
  font-size: clamp(25px, 1.8vw, 32px);
  line-height: 1.18;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.grudge-body {
  min-height: 104px;
  color: #473524;
  font-size: 17px;
  line-height: 1.78;
  overflow-wrap: anywhere;
}

.grudge-body p {
  margin: 0 0 10px;
}

.grudge-body p:last-child {
  margin-bottom: 0;
}

.grudge-card-meta {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  padding-top: 15px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.35;
  border-top: 1px dashed rgba(89, 61, 37, .25);
}

.grudge-card-meta span,
.grudge-card-meta time {
  min-width: 0;
  overflow-wrap: anywhere;
}

.grudge-reactions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px dashed rgba(89, 61, 37, .18);
}

.grudge-reaction {
  display: inline-grid;
  grid-template-columns: 24px minmax(2.6em, max-content) minmax(1.6ch, auto);
  align-items: center;
  min-width: 0;
  height: 34px;
  padding: 0 2px;
  gap: 9px;
  color: #21130e;
  background: transparent;
  border: 0;
  border-radius: 0;
  transition: color .18s ease, transform .18s ease, opacity .18s ease;
}

.grudge-reaction:hover {
  color: #8c2f25;
  transform: translateY(-1px);
}

.grudge-reaction.is-active {
  color: #8c2f25;
}

.grudge-reaction:disabled {
  cursor: default;
  opacity: .58;
}

.grudge-reaction svg {
  display: block;
  width: 24px;
  height: 24px;
}

.grudge-reaction span,
.grudge-reaction strong {
  min-width: 0;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}

.grudge-reaction strong {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.tankard-foam,
.tankard-wood {
  fill: currentColor;
}

.tankard-metal,
.tankard-grain {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dagger-blade {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2.2;
}

.dagger-core,
.dagger-guard,
.dagger-grip {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grudge-empty {
  margin: 0;
  padding: 82px 20px;
  color: rgba(86, 62, 39, .68);
  text-align: center;
  font-size: 16px;
}

.grudge-fab {
  position: fixed;
  z-index: 30;
  right: clamp(18px, 2.3vw, 42px);
  bottom: 38px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  width: 112px;
  height: 112px;
  padding: 13px;
  color: #fff0c3;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 235, 172, .22), transparent 28%),
    linear-gradient(180deg, #9b3a31, #56211c);
  border: 1px solid rgba(255, 224, 151, .62);
  border-radius: 50%;
  box-shadow: 0 18px 34px rgba(79, 43, 24, .28), inset 0 0 0 3px rgba(51, 22, 18, .4);
  transition: transform .18s ease, box-shadow .18s ease;
}

.grudge-fab:hover {
  transform: translateY(-2px) rotate(-4deg);
  box-shadow: 0 22px 42px rgba(79, 43, 24, .38), inset 0 0 0 3px rgba(51, 22, 18, .42);
}

.grudge-fab svg {
  width: 38px;
  height: 38px;
}

.grudge-fab span {
  display: block;
  color: #fff2c4;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.grudge-composer {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.grudge-composer[hidden] {
  display: none;
}

.grudge-composer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 15, .62);
  border: 0;
  opacity: 0;
  transition: opacity .18s ease;
}

.grudge-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 15px;
  width: min(560px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 24px;
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 32px, rgba(78, 50, 30, .08) 33px),
    linear-gradient(180deg, #f8ebc8, #dfc58e);
  border: 1px solid rgba(91, 58, 31, .5);
  border-radius: 6px;
  box-shadow: 0 30px 86px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(255, 255, 255, .22);
  transform: translateY(8px) scale(.97);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}

.grudge-composer.is-open .grudge-composer-backdrop {
  opacity: 1;
}

.grudge-composer.is-open .grudge-form {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.grudge-form-header {
  position: relative;
  padding-right: 44px;
}

.grudge-form-header span {
  color: #8a5b22;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-weight: 900;
}

.grudge-form-header h2 {
  margin: 5px 0 0;
  font-size: 34px;
  line-height: 1.05;
}

.grudge-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 34px;
  color: #ffe9af;
  background: #291811;
  border: 1px solid rgba(80, 43, 21, .45);
  border-radius: 50%;
}

.grudge-form label {
  display: grid;
  gap: 8px;
}

.grudge-form label span {
  color: #35241b;
  font-size: 13px;
  font-weight: 900;
}

.grudge-form em {
  color: var(--ink-soft);
  font-style: normal;
  font-weight: 500;
}

.grudge-form input,
.grudge-form textarea {
  width: 100%;
  color: var(--ink);
  background: rgba(255, 249, 230, .84);
  border: 1px solid rgba(80, 43, 21, .36);
  border-radius: 4px;
  outline: none;
}

.grudge-form input {
  height: 44px;
  padding: 0 13px;
}

.grudge-form textarea {
  min-height: 170px;
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.7;
}

.grudge-form input:focus,
.grudge-form textarea:focus {
  border-color: var(--pin);
  box-shadow: 0 0 0 3px rgba(170, 122, 45, .18);
}

.grudge-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.grudge-submit,
.grudge-cancel {
  height: 42px;
  padding: 0 17px;
  border-radius: 4px;
}

.grudge-submit {
  color: #fff0bd;
  background: linear-gradient(180deg, #8f3128, #4b1d18);
  border: 1px solid rgba(255, 224, 151, .44);
}

.grudge-cancel {
  color: #2b1d17;
  background: rgba(255, 249, 230, .55);
  border: 1px solid rgba(80, 43, 21, .24);
}

.grudge-message {
  color: #526c4c;
  font-size: 14px;
}

.grudge-message.is-error {
  color: var(--leather);
}

@media (max-width: 1180px) {
  .grudge-ledger {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 901px) and (max-width: 1585px) {
  .grudge-ledger {
    width: calc(100vw - 226px);
    max-width: none;
    margin-left: 32px;
    margin-right: auto;
  }
}

@media (max-width: 900px) {
  body::after {
    display: none;
  }

  .grudge-shell {
    padding-top: 72px;
  }

  .grudge-shell::before,
  .grudge-shell::after,
  .grudge-total {
    display: none;
  }

  .grudge-ledger {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
  }

  .grudge-fab {
    width: 86px;
    height: 86px;
    right: 20px;
    bottom: 20px;
  }

  .grudge-fab span {
    font-size: 14px;
  }
}

@media (max-width: 560px) {
  body::before {
    height: 24px;
  }

  .grudge-back {
    top: 12px;
    left: 12px;
    height: 36px;
    min-width: 64px;
  }

  .grudge-shell {
    padding: 64px 12px 88px;
  }

  .grudge-title h1 {
    font-size: 46px;
  }

  .grudge-title p {
    font-size: 13px;
  }

  .grudge-search input {
    height: 56px;
    padding-left: 50px;
  }

  .grudge-search::before {
    left: 18px;
    top: 14px;
    font-size: 27px;
  }

  .grudge-ledger {
    grid-template-columns: 1fr;
  }

  .grudge-card {
    padding: 38px 22px 18px;
  }

  .grudge-body {
    min-height: 0;
  }

  .grudge-fab {
    right: 16px;
    bottom: 16px;
    width: 78px;
    height: 78px;
  }

  .grudge-fab svg {
    width: 30px;
    height: 30px;
  }

  .grudge-fab span {
    font-size: 12px;
  }
}
