:root {
  --bg-color: #0f0f12;
  --card-bg: #18181f;
  --accent-color: #8b0000;
  --text-color: #e0e0e0;
  --gold-color: #d4af37;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

/* 鎖死全頁滾動與手機橡皮筋回彈效果 */
html, body {
  width: 100%;
  height: 100%;
  height: 100dvh; /* 使用動態視埠高度，完美適應手機網址列 */
  overflow: hidden; /* 禁止全頁上下滑動 */
  overscroll-behavior: none; /* 徹底關閉 iOS Safari / Android 彈跳與下拉重新整理 */
  touch-action: manipulation; /* 避免雙擊縮放 */
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

/* 主容器：固定在畫面中央，僅內容過長時允許內部滑動 */
.container {
  max-width: 550px;
  width: 100%;
  max-height: 92dvh; /* 確保內容不會超出手機螢幕 */
  overflow-y: auto;  /* 萬一文字太長，只允許卡片內部滾動 */
  overscroll-behavior: contain;
  background: var(--card-bg);
  border: 1px solid #2a2a35;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  text-align: center;
  
  /* 隱藏或美化內部滾動條 */
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.container::-webkit-scrollbar {
  width: 4px;
}
.container::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

/* 頂部 Header 與齒輪按鈕配置 */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

h1 {
  color: var(--gold-color);
  font-size: 1.5rem;
  letter-spacing: 1.5px;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.3s ease;
  width: auto;
}

.icon-btn:hover {
  transform: rotate(45deg);
}

.paw-status {
  font-size: 0.9rem;
  margin-bottom: 16px;
  color: #888;
}

.paw-status span {
  color: var(--gold-color);
  font-weight: bold;
}

.wish-box {
  margin-bottom: 16px;
}

textarea {
  width: 100%;
  height: 90px;
  background: #0d0d10;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  padding: 12px;
  font-size: 0.95rem;
  resize: none;
  outline: none;
  transition: border-color 0.3s;
}

textarea:focus {
  border-color: var(--gold-color);
}

button {
  width: 100%;
  padding: 12px;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
}

button:hover:not(:disabled) {
  background: #a00000;
}

button:disabled {
  background: #444;
  cursor: not-allowed;
}

.result-card {
  display: none;
  margin-top: 16px;
  text-align: left;
  background: #0f0f14;
  border-left: 4px solid var(--accent-color);
  padding: 16px;
  border-radius: 4px;
  line-height: 1.5;
}

.result-section {
  margin-bottom: 10px;
}

.result-section h3 {
  font-size: 0.9rem;
  color: var(--gold-color);
  margin-bottom: 4px;
}

.result-section p {
  font-size: 0.9rem;
  color: #ccc;
}

.share-btn {
  margin-top: 12px;
  background: #2a2a35;
  color: var(--gold-color);
  border: 1px solid var(--gold-color);
  font-size: 0.9rem;
  padding: 10px;
}

.share-btn:hover {
  background: #333344;
}

/* 載入動畫區塊 */
.loading {
  display: none;
  margin-top: 16px;
  color: var(--gold-color);
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.dots::after {
  content: '';
  display: inline-block;
  width: 20px;
  text-align: left;
  animation: dotsAnimation 1.5s infinite steps(4, end);
}

@keyframes dotsAnimation {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* 右下角低調回報按鈕 */
.card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.report-link-btn {
  background: none;
  border: none;
  color: #888899;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.2s;
  width: auto;
  text-decoration: none;
}

.report-link-btn:hover {
  color: #e63946;
}

/* 頁腳免責聲明 */
.disclaimer {
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px dashed #2a2a35;
  font-size: 0.75rem;
  color: #777788;
  text-align: center;
  letter-spacing: 0.5px;
}

/* Modal 彈窗樣式 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overscroll-behavior: none;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid #333344;
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  max-height: 85dvh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.9);
  text-align: left;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid #2a2a35;
  padding-bottom: 8px;
}

.modal-header h2 {
  font-size: 1.1rem;
  color: var(--gold-color);
}

.close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.6rem;
  cursor: pointer;
  width: auto;
  padding: 0;
  line-height: 1;
}

.modal-section {
  margin-bottom: 14px;
}

.modal-section h3 {
  font-size: 0.9rem;
  color: var(--gold-color);
  margin-bottom: 4px;
}

.modal-section p {
  font-size: 0.85rem;
  color: #aaa;
  line-height: 1.4;
}

.modal-share-btns {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.modal-btn {
  flex: 1;
  padding: 8px;
  font-size: 0.85rem;
  background: #2a2a35;
  color: #e0e0e0;
  border: 1px solid #444455;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  width: auto;
}

.modal-btn.primary {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}
