/* 全站統一設定 */
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100vh;
  font-family: 'Courier New', monospace;
  overflow: hidden;
}

/* ✅ 背景圖設定（桌機／手機共用） */
.responsive-wrapper {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  background-image: url('/images/lovecourt-bg.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #ffe6f0;
  overflow: hidden;
}
@media (max-width: 480px) {
  .responsive-wrapper {
    background-image: url('/images/手機2.png');
    background-size: cover;
  }
}

/* ✅ 控訴區塊（輸入框 + 按鈕） */
.content {
  position: absolute;
  bottom: 6vh;
  left: 0;
  width: 100%;
  padding: 0 6vw;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  z-index: 1;
}
@media (max-width: 480px) {
  .content {
    padding: 4vh 6vw;
    bottom: 3vh;
  }
}

/* ✅ 輸入框樣式 */
.input-box {
  width: 100%;
  height: 20vh;
  font-size: clamp(16px, 2.5vw, 24px);
  padding: 12px;
  border: 3px solid #ff80aa;
  background-color: #fff0f5;
  resize: none;
  box-shadow: 2px 2px #ffaacc;
  margin-bottom: 4vh;
  border-radius: 8px;
}
@media (max-width: 480px) {
  .input-box {
    height: 14vh;
    font-size: 14px;
    margin-bottom: 2vh;
  }
}

/* ✅ 審判按鈕 */
#submit-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  padding: 10px 20px;
  background-color: #ffc0cb;
  border: 3px solid #ff69b4;
  border-radius: 8px;
  color: white;
  box-shadow: 2px 2px #ff69b4;
  cursor: pointer;
  transition: transform 0.1s ease;
}
#submit-btn:hover {
  transform: scale(1.05);
}

#verdict-capture {
  position: relative;
  width: 100%;
  max-width: min(440px, 94vw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#verdict-screen {
  position: fixed; /* ✅ 讓它跳脫背景 */
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100dvh;
  z-index: 9999; /* ✅ 保證在最上層 */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 20px 16px 32px;
  background-color: rgba(255, 240, 250, 0.7);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
/* 外層：下載／分享截圖時會一併輸出「判決書下載背景」 */
#verdict-text {
  position: relative;
  width: 100%;
  max-width: min(420px, 92vw);
  margin: 0 auto;
  flex-shrink: 0;
  padding: 16px 12px 18px;
  border-radius: 12px;
  text-align: center;
  background-color: transparent;
  background-image: url('/images/判決書下載背景.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: 'Press Start 2P', cursive;
  color: #ff1493;
  line-height: 1.6;
  box-sizing: border-box;
}

.verdict-text-inner {
  background: rgba(255, 255, 255, 0.68);
  border-radius: 10px;
  padding: 12px 10px 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

/* ✅ 判決文字樣式 */
.verdict-title {
  font-family: 'Noto Serif TC', '標楷體', serif;
  font-size: 16px;
  font-weight: bold;
  color: #ff66cc;
  margin-bottom: 12px;
}
.verdict-psych {
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 13px;
  color: #9c27b0;
  margin-bottom: 10px;
  line-height: 1.5;
}
.verdict-crime {
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #ff3399;
  margin-bottom: 12px;
}
.verdict-suggestion {
  font-size: 16px;
  color: #cc3399;
  margin-bottom: 8px;
}
.verdict-judgement {
  font-size: 13px;
  color: #e6488e;
  line-height: 1.8;
}

.recommended-music {
  margin-top: 10px;
  text-align: center;
  width: 100%;
}

.recommended-music-text {
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 12px;
  color: #274567;
  font-weight: 700;
  margin: 0 0 6px 0;
}

.recommended-music-cover {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 16px;
  border: 4px solid rgba(111, 144, 224, 0.55);
  box-shadow: 0 12px 24px rgba(63, 118, 186, 0.18);
  background-color: rgba(255, 255, 255, 0.5);
}

.recommended-music-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}

.recommended-music-title {
  margin-top: 8px;
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 12px;
  color: #9c27b0;
  text-decoration: underline;
}

#recommended-music-audio {
  display: none;
}

.verdict-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
  max-width: 100%;
}

/* ✅ 判決畫面按鍵（參考遊戲 Menu 風格） */
.retry-btn,
.listen-btn,
.mediation-apply-btn {
  width: 142px;
  height: 64px;
  padding: 0;
  font-family: 'Press Start 2P', cursive;
  font-size: 9px;
  line-height: 1.35;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  border: none;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  color: #2f4f78;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
  box-shadow: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.retry-btn {
  background-image: url('/images/b1.png');
}

.mediation-apply-btn {
  background-image: url('/images/b2.png');
}

.listen-btn {
  background-image: url('/images/b3.png');
}

.verdict-export-bar {
  position: absolute;
  top: 8px;
  right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
  align-items: center;
}

.verdict-export-btn,
.verdict-share-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 2px solid rgba(79, 115, 184, 0.65);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(236, 244, 255, 0.95) 100%
  );
  color: #2f4f78;
  box-shadow: 0 4px 0 rgba(144, 168, 221, 0.9);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.verdict-export-btn:hover,
.verdict-share-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.verdict-export-btn:active,
.verdict-share-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(144, 168, 221, 0.85);
}

/* 判決分享選單 */
.retry-btn:hover,
.listen-btn:hover,
.mediation-apply-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.retry-btn:active,
.listen-btn:active,
.mediation-apply-btn:active {
  transform: translateY(2px);
}



/* ✅ 動畫與通用設定 */
.hidden {
  display: none !important;
}
.loading {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  color: #ff69b4;
  animation: bounce 1s infinite ease-in-out;
}
@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -10px); }
}
@keyframes verdictIn {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-30deg); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.05) rotate(5deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

/* ✅ 音效隱藏 */
#audio-player,
#sound-effect {
  display: none;
}

/* ✅ 調停畫面（flex 置中 + overflow 時，底部 padding 常被吃掉，改 flex-start 並加底部 spacer） */
#mediation-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 40px 20px;
  padding-bottom: max(48px, calc(32px + env(safe-area-inset-bottom, 0px)));
  box-sizing: border-box;
  background-color: rgba(255, 240, 250, 0.7);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#mediation-container {
  width: 100%;
  max-width: 520px;
  flex: 0 0 auto;
}

/* 內容偏短時仍大致置中（不影響長文捲動） */
@media (min-height: 640px) {
  #mediation-screen {
    padding-top: max(40px, min(12vh, 80px));
  }
}

#mediation-content {
  padding-bottom: 8px;
}

/* 捲到底時「回到首頁」下方固定留白（保證可捲動距離） */
.mediation-bottom-spacer {
  width: 100%;
  height: max(72px, calc(44px + env(safe-area-inset-bottom, 0px)));
  min-height: max(72px, calc(44px + env(safe-area-inset-bottom, 0px)));
  flex-shrink: 0;
  pointer-events: none;
}

/* 調停頁：標題／狀態 */
.mediation-page-heading {
  width: 100%;
  text-align: left;
}

/* 最終和解書頁：推薦曲在案件摘要上方、置中，與判決頁同款尺寸 */
#mediation-section-responded .mediation-recommended-music {
  margin: 0 0 14px;
  width: 100%;
  max-width: 100%;
  text-align: center;
}

#mediation-section-responded .mediation-recommended-music .recommended-music-cover {
  width: 110px;
  height: 110px;
}

#mediation-recommended-music-audio {
  display: none;
}

.mediation-link-container {
  margin-top: 14px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  color: #c2185b;
  text-align: center;
  font-size: 14px;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.mediation-link-container a {
  color: #ff1493;
  text-decoration: underline;
  word-break: break-all;
  display: inline-block;
  margin-top: 4px;
}

.mediation-link-copy-btn {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid #ff8fc7;
  background: #fff4fa;
  color: #c2185b;
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 13px;
  cursor: pointer;
}

.mediation-respond-btn {
  margin-top: 14px;
  width: 100%;
  padding: 12px 16px;
  font-family: 'Press Start 2P', cursive;
  background-color: #ff69b4;
  border: 3px solid #ff69b4;
  border-radius: 8px;
  color: white;
  box-shadow: 2px 2px #ff69b4;
  cursor: pointer;
  font-size: 10px;
}

.mediation-export-btn {
  margin-top: 12px;
  width: 100%;
  padding: 10px 16px;
  font-family: 'Press Start 2P', cursive;
  background-color: #9eb5e7;
  border: 3px solid #7d96cc;
  border-radius: 8px;
  color: white;
  box-shadow: 2px 2px #7d96cc;
  cursor: pointer;
  font-size: 10px;
}

.mediation-back-btn {
  margin-top: 20px;
  margin-bottom: 12px;
  width: 100%;
  padding: 10px 16px;
  font-family: 'Press Start 2P', cursive;
  background-color: #ffc0cb;
  border: 3px solid #ff69b4;
  border-radius: 8px;
  color: white;
  box-shadow: 2px 2px #ff69b4;
  cursor: pointer;
  font-size: 10px;
}

.mediation-story {
  margin-top: 10px;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 14px 14px;
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  color: #333;
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 14px;
  border: 3px solid rgba(255, 128, 170, 0.35);
  box-shadow: 2px 2px rgba(255, 170, 204, 0.5);
}

/* 案件摘要（與下方和解書區塊同寬） */
.mediation-settlement-head {
  width: 100%;
  max-width: 90%;
  margin: 0 auto;
}

.mediation-case-summary-wrap {
  width: 100%;
  margin-bottom: 10px;
  text-align: left;
}

.mediation-case-summary-label {
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  margin: 0 0 8px 0;
}

.mediation-case-summary {
  margin: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  background-color: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  border: 3px solid rgba(255, 128, 170, 0.35);
  box-shadow: 2px 2px rgba(255, 170, 204, 0.5);
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 14px;
  color: #333;
  line-height: 1.8;
  text-align: left;
}

/* 和解書主文：黑色、置左（與 mediation-story 一致） */
.mediation-settlement {
  margin-top: 0;
  width: 100%;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  background-color: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  color: #333;
  text-align: left;
  line-height: 1.8;
  font-size: 14px;
  border: 3px solid rgba(255, 128, 170, 0.35);
  box-shadow: 2px 2px rgba(255, 170, 204, 0.5);
}

.mediation-settlement .settlement-p {
  margin: 0 0 12px 0;
}

#mediation-section-responded .mediation-recommended-music {
  width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.mediation-settlement .settlement-p--lead,
.mediation-settlement .settlement-p--psych,
.mediation-settlement .settlement-p--crime,
.mediation-settlement .settlement-p--suggestion,
.mediation-settlement .settlement-p--judgement {
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  font-size: 14px;
  font-weight: normal;
  color: #333;
  line-height: 1.8;
  margin-bottom: 12px;
}

.mediation-settlement .settlement-p:last-child {
  margin-bottom: 0;
}

/* 無案件摘要時，主文與上方內容留白 */
#mediation-settlement-head:not(:has(.mediation-case-summary-wrap:not(.hidden)))
  + #mediation-settlement-text {
  margin-top: 10px;
}

.mediation-label {
  display: block;
  margin-top: 14px;
  font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
  color: #c2185b;
  font-size: 14px;
  margin-bottom: 6px;
}
