/* おたよりポスト｜サイト常駐の感想ウィジェット (assets/js/otayori-post.js 用)
   配色: 生成り #f8f2df / 紺 #1f3350 / ポストの赤 #c22f2f
   クラスは op- 接頭辞で既存CSSとの衝突を避ける。 */

.op-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Noto Sans JP", "Yu Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* --- 右下の丸ボタン --- */
.op-fab {
  position: relative;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid rgba(31, 51, 80, 0.25);
  border-radius: 50%;
  background: #f8f2df;
  box-shadow: 0 6px 18px rgba(20, 30, 50, 0.28);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.op-fab:focus-visible {
  outline: 2px solid #1f3350;
  outline-offset: 2px;
}

.op-fab-post {
  display: block;
  width: 36px;
  height: 36px;
  line-height: 0;
}

.op-fab-post svg {
  width: 100%;
  height: 100%;
}

.op-fab-plane {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  padding: 3px;
  border-radius: 50%;
  background: #1f3350;
  line-height: 0;
  box-sizing: border-box;
}

.op-fab-plane svg {
  width: 100%;
  height: 100%;
}

.op-fab-plane svg path {
  fill: #f8f2df;
  stroke: none;
}

.op-fab:hover .op-fab-post {
  animation: op-wiggle 0.5s ease-in-out;
}

.op-fab-label {
  margin-top: 5px;
  padding: 2px 9px;
  border: 1px solid rgba(31, 51, 80, 0.25);
  border-radius: 999px;
  background: #f8f2df;
  color: #1f3350;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  box-shadow: 0 3px 10px rgba(20, 30, 50, 0.18);
  cursor: pointer;
  user-select: none;
}

@keyframes op-wiggle {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-4deg); }
  55% { transform: rotate(3deg); }
  100% { transform: rotate(0deg); }
}

/* --- 便箋パネル --- */
.op-panel {
  position: fixed;
  right: 16px;
  bottom: 104px;
  width: min(344px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 16px 16px 14px 20px;
  border: 1px solid rgba(31, 51, 80, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(to right, transparent 0, transparent 27px, rgba(194, 47, 47, 0.22) 27px, rgba(194, 47, 47, 0.22) 28px, transparent 28px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 27px, rgba(31, 51, 80, 0.07) 27px, rgba(31, 51, 80, 0.07) 28px),
    #f8f2df;
  box-shadow: 0 14px 36px rgba(20, 30, 50, 0.28);
  color: #24344d;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.op-panel.op-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.op-panel-head {
  position: relative;
  margin-bottom: 10px;
  padding-right: 32px;
}

.op-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1f3350;
  letter-spacing: 0.04em;
}

.op-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: rgba(31, 51, 80, 0.75);
}

.op-close {
  position: absolute;
  top: -4px;
  right: -6px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #1f3350;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.op-close:hover {
  background: rgba(31, 51, 80, 0.08);
}

/* --- 入力フォーム --- */
.op-form {
  margin: 0;
}

.op-label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #1f3350;
}

.op-textarea,
.op-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 5px;
  padding: 8px 10px;
  border: 1px solid rgba(31, 51, 80, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #24344d;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
}

.op-textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.6;
}

.op-textarea:focus,
.op-input:focus {
  outline: 2px solid rgba(31, 51, 80, 0.55);
  outline-offset: 0;
  border-color: #1f3350;
}

.op-ts {
  min-height: 66px;
  margin: 2px 0 10px;
}

.op-error {
  margin: 0 0 10px;
  padding: 7px 9px;
  border-radius: 6px;
  background: rgba(179, 38, 30, 0.09);
  color: #b3261e;
  font-size: 12.5px;
  line-height: 1.5;
}

.op-send {
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 999px;
  background: #1f3350;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.op-send:hover {
  background: #2a4568;
}

.op-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* --- 送信後の表示 --- */
.op-success {
  text-align: center;
  padding-top: 2px;
}

.op-fly {
  position: relative;
  height: 108px;
  margin: 0 4px;
}

.op-plane {
  position: absolute;
  left: 4px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  line-height: 0;
}

.op-plane svg {
  width: 100%;
  height: 100%;
}

.op-postbox {
  position: absolute;
  right: 6px;
  bottom: 4px;
  width: 54px;
  height: 54px;
  line-height: 0;
}

.op-postbox svg {
  width: 100%;
  height: 100%;
}

.op-success-show .op-plane {
  animation: op-fly-away 1.5s ease-in forwards;
}

@keyframes op-fly-away {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  55% { transform: translate(130px, -48px) rotate(10deg) scale(0.85); opacity: 1; }
  100% { transform: translate(215px, -34px) rotate(20deg) scale(0.35); opacity: 0; }
}

.op-stamp {
  display: inline-block;
  width: 56px;
  height: 56px;
  margin: 2px 0 8px;
  border: 2.5px solid #c22f2f;
  border-radius: 50%;
  color: #c22f2f;
  font-size: 15px;
  font-weight: 700;
  line-height: 56px;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  transform: rotate(-8deg);
  box-sizing: border-box;
  position: relative;
}

.op-stamp::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(194, 47, 47, 0.55);
  border-radius: 50%;
}

.op-success-show .op-stamp {
  animation: op-stamp-in 0.35s ease-out 0.95s backwards;
}

@keyframes op-stamp-in {
  0% { transform: rotate(-8deg) scale(2.1); opacity: 0; }
  100% { transform: rotate(-8deg) scale(1); opacity: 1; }
}

.op-thanks {
  margin: 0 0 6px;
  font-size: 14px;
  color: #1f3350;
}

.op-success-show .op-thanks {
  animation: op-fade-in 0.5s ease 1.15s backwards;
}

@keyframes op-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- スマホ: パネルをボトムシート風に --- */
@media (max-width: 640px) {
  .op-panel {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    border-radius: 16px;
  }

  .op-root {
    right: 12px;
    bottom: 12px;
  }
}

/* --- 動きを減らす設定ではアニメーションを省略 --- */
@media (prefers-reduced-motion: reduce) {
  .op-fab:hover .op-fab-post,
  .op-success-show .op-plane,
  .op-success-show .op-stamp,
  .op-success-show .op-thanks {
    animation: none;
  }

  .op-panel {
    transition: none;
  }

  .op-plane {
    display: none;
  }
}
