.village-login {
  --letter-ink: #352839;
  --letter-paper: #fff4da;
  height: 100%;
  overflow: auto;
  color: var(--letter-ink);
  background: #5b795d url('/village/login-post-office.webp') 45% center / cover no-repeat;
}

.login-layout {
  min-height: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 36px clamp(28px, 6vw, 120px);
  background: linear-gradient(90deg, transparent 45%, #29342626);
}

.login-letter {
  position: relative;
  width: min(100%, 390px);
  padding: 30px clamp(24px, 3vw, 38px) 36px;
  border: 3px solid var(--letter-ink);
  background: var(--letter-paper);
  box-shadow: inset 0 0 0 4px #fffaf0, inset 0 0 0 6px #deca9c, 4px 5px 0 #a99169, 7px 8px 0 var(--letter-ink), 10px 14px 0 #2b1d2e40;
}

.login-letter::before {
  content: '';
  display: block;
  height: 5px;
  position: absolute;
  inset: 7px 7px auto;
  background: repeating-linear-gradient(125deg, #b0604d 0 10px, transparent 10px 22px, #7c94a3 22px 32px, transparent 32px 44px);
}

.login-letterhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.login-wordmark, .login-letter h1, .login-letter label, .login-letter :is(button, .letter-link) {
  font-weight: 400;
}
.login-wordmark { font-size: 26px; color: #745136; }
.login-stamp {
  display: grid;
  place-items: center;
  width: 62px;
  height: 54px;
  border: 3px dotted #ab977a;
  background: #d6e5d8;
  box-shadow: inset 0 0 0 3px #fffae8;
  transform: rotate(5deg);
}
.login-stamp img { image-rendering: pixelated; }
.login-letter h1 { margin: 0; font-size: clamp(36px, 4vw, 46px); line-height: 1.12; }
.login-intro, .login-notice {
  font-size: 18px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.login-intro { margin: 10px 0 0; color: #695647; }
.login-letter form {
  display: grid;
  margin-top: 23px;
  padding-top: 20px;
  border-top: 1px dashed #b59c77;
}
.login-letter label { margin-bottom: 7px; font-size: 20px; }
.login-letter input {
  min-width: 0;
  height: 48px;
  padding: 0 13px;
  border: 2px solid #806d58;
  border-radius: 2px;
  box-shadow: inset 0 2px #e9dfc8;
  background: #fffcf4;
  color: var(--letter-ink);
  font: inherit;
}
.login-letter input::placeholder { color: #796c60; }
.login-letter :is(button, .letter-link) {
  margin-top: 14px;
  min-height: 49px;
  border: 2px solid var(--letter-ink);
  border-radius: 2px;
  background: #f6c65a;
  color: var(--letter-ink);
  box-shadow: inset 0 2px #ffe5a0, inset 0 -3px #d69a39, 0 3px var(--letter-ink);
  font-size: 23px;
}
.login-letter :is(button, .letter-link):hover:not(:disabled) { background: #ffda77; }
.login-letter :is(button, .letter-link):active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px #d69a39, 0 1px var(--letter-ink); }
.login-letter button:disabled { cursor: wait; background: #e0d3ae; }
.login-letter :is(input, button, .letter-link):focus-visible { outline: 3px solid #583e8c; outline-offset: 3px; }
.letter-link { display: grid; place-items: center; text-decoration: none; }
.login-notice { margin: 16px 0 0; padding: 9px 12px; border-left: 3px solid #527750; background: #e8ecd4; color: #364a32; }
.login-error { border-color: #ac5144; background: #f9e2cf; color: #7f362d; }

@media (max-width: 660px) {
  .village-login {
    background-color: #53664e;
    background-image: linear-gradient(to bottom, transparent 38%, #53664e 64%), url('/village/login-post-office.webp');
    background-position: center, 34% top;
    background-size: 100% 100%, auto max(65%, 350px);
  }
  .login-layout {
    justify-content: center;
    align-items: flex-start;
    padding: clamp(110px, 39svh, 350px) 18px 26px;
    background: linear-gradient(to bottom, transparent 180px, #43513b66 450px);
  }
  .login-letter { padding: 23px 24px 27px; }
  .login-letterhead { margin-bottom: 8px; }
  .login-stamp { width: 54px; height: 46px; }
  .login-letter form { margin-top: 16px; padding-top: 15px; }
}

.login-letter > button { width: 100%; }
[data-letter='invite'] .login-letter { width: min(100%, 420px); }
[data-letter='pair'] .login-letter { width: min(100%, 520px); }
.letter-invitation, .letter-code {
  margin: 18px 0;
  border-block: 1px dashed #b59c77;
  background: #f7e9c8;
  overflow-wrap: anywhere;
}
.letter-invitation { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 6px 16px; padding: 14px; }
.letter-invitation dt, .letter-code span { color: #695647; font-size: 17px; }
.letter-invitation dd { margin: 0; font: 22px/1.2 var(--village-font); }
.letter-code { display: grid; gap: 4px; padding: 10px; text-align: center; }
.letter-code strong { font: 27px/1.2 var(--village-font); letter-spacing: .12em; }
.letter-permissions { margin-top: 16px; padding-top: 14px; border-top: 1px dashed #b59c77; font-size: 17px; line-height: 1.55; }
.letter-permissions h2 { margin: 0 0 4px; font: 21px/1.25 var(--village-font); }
.letter-permissions ul { margin: 0 0 12px; padding-left: 1.3em; }
.letter-permissions li::marker { color: #8b6a38; }
.letter-permissions p { margin: 0; }
.login-warning { border-color: #a97122; color: #67451c; background: #fae4af; }
@media (max-width: 660px) {
  [data-letter='pair'] .login-layout { padding-top: clamp(36px, 14svh, 110px); }
}

dialog.village-question {
  --letter-paper: #fff4da;
  --letter-ink: #352839;
  position: fixed;
  width: min(410px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  margin: auto;
  color: var(--letter-ink);
}
.village-question::backdrop { background: #302b32a6; }
.village-question h2 { margin: 0; font-size: 26px; font-weight: 400; }
.village-question p { white-space: pre-line; }
.village-question label input { display: block; width: 100%; }
.village-question-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.village-question-actions button { margin: 0; padding: 3px 14px; min-height: 40px; font-size: 20px; }
.village-question-actions button[type=button] { background: #f7e9c8; }
