/*
 * 便箋の末尾の回答欄と、「同意しない」を押したときのエラー窓。
 * エラー窓は便箋の明朝と対比させ、端末の警告のようなゴシックで出す。
 */

.answer {
  margin-top: 40px;
  text-align: center;
}

.answer__title {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.3em;
}

.answer__title::before,
.answer__title::after {
  flex: 1;
  height: 1px;
  background: var(--gold-line);
  content: '';
}

.answer__choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.answer__choices[hidden] {
  display: none;
}

.answer__button {
  min-width: 9em;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: 2px;
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.16em;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.answer__button:active {
  transform: translateY(1px);
}

.answer__button:focus-visible,
.error-dialog__button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.answer__button--accept {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.answer__button--accept:hover {
  background: #3a3f45;
}

.answer__button--decline {
  border-color: rgba(91, 95, 100, 0.45);
  background: transparent;
  color: var(--muted);
}

.answer__button--decline:hover {
  background: rgba(91, 95, 100, 0.06);
}

/* 承諾の結果。朱の丸印を押してから文面を出す。 */
.answer__result {
  display: grid;
  justify-items: center;
  margin-top: 22px;
}

.answer__result[hidden] {
  display: none;
}

.answer__stamp {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 3px solid var(--hanko);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4.5px var(--hanko);
  color: var(--hanko);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.92;
  transform: rotate(-10deg);
  animation: answer-stamp 420ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.answer__thanks {
  margin-top: 18px;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0.08em;
  line-height: 2;
  word-break: keep-all;
  overflow-wrap: anywhere;
  animation: answer-fade 500ms 300ms ease-out both;
}

.answer__note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.06em;
  line-height: 1.9;
  word-break: keep-all;
  overflow-wrap: anywhere;
  animation: answer-fade 500ms 450ms ease-out both;
}

@keyframes answer-stamp {
  0% { opacity: 0; transform: rotate(-18deg) scale(1.9); }
  60% { opacity: 0.92; transform: rotate(-10deg) scale(0.94); }
  100% { opacity: 0.92; transform: rotate(-10deg) scale(1); }
}

@keyframes answer-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* エラー窓 */
.error-dialog {
  width: min(calc(100vw - 40px), 360px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.45);
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP', sans-serif;
}

.error-dialog[open] {
  animation: error-shake 420ms ease-out both;
}

.error-dialog::backdrop {
  background: rgba(20, 20, 24, 0.45);
}

.error-dialog__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: #d93025;
  color: #ffffff;
}

.error-dialog__icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  color: #d93025;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.error-dialog__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.error-dialog__code {
  margin-left: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  opacity: 0.85;
}

.error-dialog__message {
  padding: 20px 20px 4px;
  font-size: 15px;
  line-height: 1.75;
  line-break: strict;
  white-space: pre-line;
}

.error-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 20px 20px;
}

.error-dialog__button {
  padding: 10px 16px;
  border: 1px solid #c7c7cc;
  border-radius: 8px;
  background: #ffffff;
  color: #1d1d1f;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.error-dialog__button--accept {
  border-color: #d93025;
  background: #d93025;
  color: #ffffff;
}

@keyframes error-shake {
  0% { transform: translateX(0) scale(0.92); opacity: 0; }
  25% { transform: translateX(-10px) scale(1); opacity: 1; }
  45% { transform: translateX(8px); }
  65% { transform: translateX(-5px); }
  85% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

@media (min-width: 640px) {
  .answer {
    margin-top: 48px;
  }

  .answer__button {
    min-width: 10em;
    font-size: 17px;
  }
}
