body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: #f5f5f7;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 40px 20px;
  color: #1d1d1f;
  margin: 0;
}

.container {
  background: white;
  border-radius: 18px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 10px 20px rgba(0, 0, 0, 0.05);
  padding: 48px;
  width: 100%;
  max-width: 680px;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 標題區 */
.header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 0.5px solid #d2d2d7;
}

.title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  color: #1d1d1f;
}

.subtitle {
  font-size: 15px;
  color: #86868b;
  font-weight: 400;
  margin: 0;
}

/* 目前 Rich Menu 區域 */
.current-richmenu-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 0.5px solid #d2d2d7;
}

.current-richmenu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.current-richmenu-header .section-title {
  margin: 0;
}

.btn-refresh {
  width: auto;
  min-width: auto;
  padding: 8px 12px;
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  background: #e8e8ed;
  transform: scale(1.05);
}

.btn-refresh .btn-icon {
  font-size: 16px;
}

.current-richmenu-card {
  background: #f5f5f7;
  border-radius: 12px;
  overflow: hidden;
}

.current-richmenu-image {
  position: relative;
  width: 100%;
  background: #ffffff;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.current-richmenu-image img {
  width: 100%;
  height: auto;
  display: block;
}

.current-richmenu-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.current-richmenu-loading.hidden {
  display: none;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #d2d2d7;
  border-top: 3px solid #000000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 14px;
  color: #86868b;
  font-weight: 500;
}

.current-richmenu-info {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 12px;
  color: #86868b;
  font-weight: 500;
}

.info-value {
  font-size: 13px;
  color: #1d1d1f;
  font-weight: 500;
  font-family: 'SF Mono', 'Monaco', monospace;
  word-break: break-all;
}

/* 區段樣式 */
section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1d1d1f;
  letter-spacing: -0.3px;
}

/* 上傳區 */
.upload-section {
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 15px;
  color: #1d1d1f;
}

.hint {
  font-size: 13px;
  color: #86868b;
  margin: 4px 0 12px 0;
}

.input-group input[type="file"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #d2d2d7;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  background: white;
  color: #1d1d1f;
  cursor: pointer;
}

.input-group input[type="file"]:hover {
  border-color: #86868b;
}

.input-group input[type="file"]:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d2d2d7;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  background: white;
  color: #1d1d1f;
}

.input-group input:focus,
.input-group select:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* 圖片編輯區 */
.editor-section {
  margin-bottom: 24px;
}

.image-container {
  position: relative;
  display: inline-block;
  width: 100%;
  min-height: 300px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  background: #f5f5f7;
}

.image-container img {
  max-width: 100%;
  display: block;
  width: 100%;
}

.placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f5f5f7;
  transition: opacity 0.3s ease;
}

.placeholder.hidden {
  opacity: 0;
  pointer-events: none;
}

.placeholder-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.placeholder-text {
  font-size: 17px;
  color: #86868b;
  font-weight: 500;
}

/* 矩形區域樣式 */
.rect {
  position: absolute;
  border: 2px solid #007aff;
  background-color: rgba(0, 122, 255, 0.3);
  box-sizing: border-box;
  cursor: move;
  transition: box-shadow 0.2s ease;
}

.rect:hover {
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.rect .label {
  position: absolute;
  top: 4px;
  left: 4px;
  font-weight: 600;
  color: #007aff;
  opacity: 0.3;
  pointer-events: none;
  font-size: 16px;
}

.rect .handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #007aff;
  border: 2px solid white;
  border-radius: 50%;
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.rect .close-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #ff3b30;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  text-align: center;
  line-height: 24px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.rect .close-btn:hover {
  background: #d1242f;
  transform: scale(1.1);
}

/* 控制區 */
.controls-section {
  margin-bottom: 24px;
}

.slider {
  margin-bottom: 20px;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider input[type="range"] {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #d2d2d7;
  outline: none;
  -webkit-appearance: none;
  border: none;
  padding: 0;
}

.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000000;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.slider input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000000;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#opacityValue {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 14px;
  color: #86868b;
  min-width: 45px;
  text-align: right;
  font-weight: 500;
}

/* 按鈕組 */
.button-group {
  display: flex;
  gap: 12px;
}

button {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: #000000;
  color: white;
}

.btn-primary:hover {
  background: #2c2c2e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
}

.btn-secondary:hover {
  background: #e8e8ed;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 16px;
}

/* 輸出區 */
.output-section {
  margin-bottom: 24px;
}

#output {
  background: #f5f5f7;
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 13px;
  color: #1d1d1f;
  line-height: 1.6;
  border: 1px solid #d2d2d7;
}

/* 動作設定區 */
.action-section h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #1d1d1f;
  letter-spacing: -0.3px;
}

.action-item {
  margin-bottom: 20px;
  padding: 20px;
  background: #f5f5f7;
  border-radius: 12px;
}

.action-item h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1d1d1f;
}

.action-item .gray {
  background: white;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #86868b;
  font-family: 'SF Mono', 'Monaco', monospace;
}

.action-fields {
  margin-top: 12px;
}

hr {
  border: none;
  border-top: 0.5px solid #d2d2d7;
  margin: 24px 0;
}

small {
  color: #86868b;
  font-size: 13px;
  display: block;
  margin-top: 6px;
}

/* 頁尾 */
.footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 0.5px solid #d2d2d7;
  text-align: center;
}

.shortcuts {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.shortcut-item {
  font-size: 13px;
  color: #86868b;
  display: flex;
  align-items: center;
  gap: 4px;
}

kbd {
  background: #f5f5f7;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  padding: 4px 8px;
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 12px;
  color: #1d1d1f;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 滾動條樣式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d2d2d7;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #86868b;
}

/* 輸入框禁用狀態 */
input:disabled,
select:disabled {
  background: #f5f5f7;
  color: #86868b;
  cursor: not-allowed;
}

/* 響應式設計 */

/* 大螢幕 (Desktop Large - 1200px+) */
@media (min-width: 1200px) {
  .container {
    max-width: 800px;
    padding: 56px;
  }
}

/* 平板橫向 (Tablet Landscape - 992px ~ 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
  .container {
    max-width: 720px;
    padding: 48px;
  }
}

/* 平板直向 (Tablet Portrait - 768px ~ 991px) */
@media (max-width: 991px) and (min-width: 768px) {
  .container {
    max-width: 680px;
    padding: 40px;
  }
  
  .title {
    font-size: 28px;
  }
  
  .section-title {
    font-size: 18px;
  }
}

/* 手機橫向 (Mobile Landscape - 576px ~ 767px) */
@media (max-width: 767px) and (min-width: 576px) {
  body {
    padding: 24px 16px;
  }
  
  .container {
    padding: 32px 24px;
    border-radius: 16px;
  }
  
  /* 標題調整 */
  .header {
    margin-bottom: 32px;
    padding-bottom: 24px;
  }
  
  .title {
    font-size: 26px;
  }
  
  .subtitle {
    font-size: 14px;
  }
  
  /* 區段間距縮小 */
  section {
    margin-bottom: 24px;
  }
  
  .section-title {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  /* 按鈕調整 */
  .button-group {
    flex-direction: column;
  }
  
  button {
    padding: 12px 20px;
    font-size: 14px;
  }
  
  /* 圖片容器 */
  .image-container {
    min-height: 250px;
  }
  
  .placeholder-icon {
    font-size: 48px;
  }
  
  .placeholder-text {
    font-size: 15px;
  }
  
  /* 輸入框 */
  .input-group input,
  .input-group select {
    font-size: 14px;
    padding: 10px 12px;
  }
  
  /* 頁尾 */
  .shortcuts {
    flex-direction: column;
    gap: 12px;
  }
  
  .shortcut-item {
    font-size: 12px;
  }
}

/* 手機直向 (Mobile Portrait - 小於 576px) */
@media (max-width: 575px) {
  body {
    padding: 16px 12px;
  }
  
  .container {
    padding: 24px 20px;
    border-radius: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07), 0 6px 12px rgba(0, 0, 0, 0.05);
  }
  
  /* 標題區 */
  .header {
    margin-bottom: 24px;
    padding-bottom: 20px;
  }
  
  .title {
    font-size: 24px;
    letter-spacing: -0.3px;
  }
  
  .subtitle {
    font-size: 13px;
    line-height: 1.4;
  }
  
  /* 目前 Rich Menu 區域 */
  .current-richmenu-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
  }
  
  .current-richmenu-header .section-title {
    font-size: 17px;
  }
  
  .btn-refresh {
    padding: 6px 10px;
  }
  
  .current-richmenu-info {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }
  
  .info-label {
    font-size: 11px;
  }
  
  .info-value {
    font-size: 12px;
  }
  
  /* 區段間距 */
  section {
    margin-bottom: 20px;
  }
  
  .section-title {
    font-size: 17px;
    margin-bottom: 10px;
  }
  
  /* 上傳區 */
  .upload-section {
    margin-bottom: 20px;
  }
  
  .input-group label {
    font-size: 14px;
    margin-bottom: 6px;
  }
  
  .hint {
    font-size: 12px;
    margin-bottom: 10px;
  }
  
  .input-group input[type="file"] {
    font-size: 13px;
    padding: 10px 12px;
  }
  
  .input-group input,
  .input-group select {
    font-size: 14px;
    padding: 10px 12px;
  }
  
  /* 圖片編輯區 */
  .image-container {
    min-height: 200px;
    border-radius: 10px;
  }
  
  .placeholder-icon {
    font-size: 40px;
    margin-bottom: 12px;
  }
  
  .placeholder-text {
    font-size: 14px;
  }
  
  /* 矩形控制項 */
  .rect {
    border-width: 1.5px;
  }
  
  .rect .handle {
    width: 14px;
    height: 14px;
    bottom: -7px;
    right: -7px;
  }
  
  .rect .close-btn {
    width: 26px;
    height: 26px;
    line-height: 26px;
    top: -13px;
    right: -13px;
    font-size: 18px;
  }
  
  .rect .label {
    font-size: 14px;
  }
  
  /* 控制區 */
  .slider-wrapper {
    gap: 10px;
  }
  
  #opacityValue {
    font-size: 13px;
    min-width: 40px;
  }
  
  /* 按鈕組 */
  .button-group {
    flex-direction: column;
    gap: 10px;
  }
  
  button {
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 10px;
  }
  
  .btn-icon {
    font-size: 15px;
  }
  
  /* 輸出區 */
  #output {
    padding: 12px;
    font-size: 12px;
    border-radius: 10px;
  }
  
  /* 動作設定區 */
  .action-section h2 {
    font-size: 20px;
    margin-bottom: 16px;
  }
  
  .action-item {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 10px;
  }
  
  .action-item h3 {
    font-size: 15px;
    margin-bottom: 10px;
  }
  
  .action-item .gray {
    padding: 8px 10px;
    font-size: 12px;
    margin-bottom: 10px;
  }
  
  /* 頁尾 */
  .footer {
    margin-top: 24px;
    padding-top: 20px;
  }
  
  .shortcuts {
    flex-direction: column;
    gap: 10px;
  }
  
  .shortcut-item {
    font-size: 12px;
  }
  
  kbd {
    padding: 3px 6px;
    font-size: 11px;
    border-radius: 4px;
  }
  
  /* 分隔線 */
  hr {
    margin: 20px 0;
  }
}

/* 超小手機 (Extra Small - 小於 375px) */
@media (max-width: 374px) {
  body {
    padding: 12px 8px;
  }
  
  .container {
    padding: 20px 16px;
    border-radius: 12px;
  }
  
  .title {
    font-size: 22px;
  }
  
  .subtitle {
    font-size: 12px;
  }
  
  button {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .input-group input,
  .input-group select {
    padding: 9px 10px;
    font-size: 13px;
  }
  
  .image-container {
    min-height: 180px;
  }
  
  .placeholder-icon {
    font-size: 36px;
  }
  
  .placeholder-text {
    font-size: 13px;
  }
}

/* 橫向模式優化 */
@media (max-height: 600px) and (orientation: landscape) {
  body {
    padding: 16px;
  }
  
  .container {
    padding: 24px;
  }
  
  .header {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }
  
  .title {
    font-size: 24px;
  }
  
  section {
    margin-bottom: 16px;
  }
  
  .image-container {
    min-height: 200px;
  }
}

/* 高解析度螢幕優化 (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .rect {
    border-width: 1.5px;
  }
  
  .status-item {
    border-bottom-width: 0.5px;
  }
  
  hr {
    border-top-width: 0.5px;
  }
}

/* 觸控裝置優化 */
@media (hover: none) and (pointer: coarse) {
  /* 增加可觸控區域 */
  button {
    min-height: 44px;
    padding: 14px 24px;
  }
  
  .input-group input,
  .input-group select {
    min-height: 44px;
  }
  
  .rect .handle {
    width: 20px;
    height: 20px;
    bottom: -10px;
    right: -10px;
  }
  
  .rect .close-btn {
    width: 32px;
    height: 32px;
    line-height: 32px;
    top: -16px;
    right: -16px;
  }
  
  /* 移除 hover 效果 */
  button:hover {
    transform: none;
  }
  
  .rect:hover {
    box-shadow: none;
  }
}

/* 深色模式支援 (可選) */
@media (prefers-color-scheme: dark) {
  /* 如果需要深色模式，可以在這裡添加樣式 */
  /* 目前保持淺色主題，符合 Apple 官網風格 */
}

/* 列印樣式 */
@media print {
  body {
    background: white;
    padding: 0;
  }
  
  .container {
    box-shadow: none;
    border: 1px solid #d2d2d7;
    max-width: 100%;
  }
  
  button,
  .footer,
  .upload-section {
    display: none;
  }
  
  .image-container {
    box-shadow: none;
    border: 1px solid #d2d2d7;
  }
}
/* 會員選擇區 */
.member-section {
  margin-bottom: 32px;
}

.member-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.member-header .section-title {
  margin: 0;
}

/* 搜尋框 */
.search-box {
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #d2d2d7;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  background: white;
  color: #1d1d1f;
}

.search-box input:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* 會員列表 */
.member-list {
  background: #f5f5f7;
  border-radius: 12px;
  padding: 12px;
  max-height: 400px;
  overflow-y: auto;
  position: relative;
}

.member-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 12px;
}

.member-loading.hidden {
  display: none;
}

.member-item {
  background: white;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-item:hover {
  background: #fafafa;
  transform: translateX(2px);
}

.member-item.selected {
  border-color: #007aff;
  background: rgba(0, 122, 255, 0.05);
}

.member-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 6px;
  border: 2px solid #d2d2d7;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.member-item.selected .member-checkbox {
  background: #007aff;
  border-color: #007aff;
}

.member-checkbox::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.member-item.selected .member-checkbox::after {
  opacity: 1;
}

.member-info {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.member-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member-label {
  font-size: 12px;
  color: #86868b;
  font-weight: 500;
}

.member-value {
  font-size: 14px;
  color: #1d1d1f;
  font-weight: 500;
}

.member-uid {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 11px;
  color: #86868b;
  word-break: break-all;
}

/* 已選擇的會員 */
.selected-members {
  margin-top: 16px;
  padding: 16px;
  background: rgba(0, 122, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(0, 122, 255, 0.2);
}

.selected-members h4 {
  font-size: 15px;
  font-weight: 600;
  color: #007aff;
  margin-bottom: 12px;
}

.selected-members h4 span {
  background: #007aff;
  color: white;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-tag {
  background: white;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #1d1d1f;
}

.selected-tag .remove-btn {
  background: #ff3b30;
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.selected-tag .remove-btn:hover {
  background: #d1242f;
  transform: scale(1.1);
}

/* 綁定按鈕 */
.btn-bind {
  width: 100%;
  padding: 16px 24px;
  background: #34c759;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-bind:hover:not(:disabled) {
  background: #30a14e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

.btn-bind:disabled {
  background: #d2d2d7;
  color: #86868b;
  cursor: not-allowed;
  transform: none;
}

/* 綁定歷史 */
.history-section {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 0.5px solid #d2d2d7;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  background: #f5f5f7;
  border-radius: 10px;
  padding: 16px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.history-richmenu-id {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 12px;
  color: #007aff;
  font-weight: 500;
}

.btn-preview-image {
  background: white;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  min-width: 32px;
  height: 24px;
}

.btn-preview-image .btn-icon {
  font-size: 14px;
  line-height: 1;
  display: inline-block;
}

.btn-preview-image:hover {
  background: #007aff;
  border-color: #007aff;
  transform: scale(1.05);
}

.btn-preview-image:hover .btn-icon {
  filter: grayscale(1) brightness(10);
}

.history-time {
  font-size: 12px;
  color: #86868b;
  white-space: nowrap;
}

.history-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.history-member-tag {
  background: white;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: #1d1d1f;
}

.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-unbind {
  background: #ff3b30;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-unbind .btn-icon {
  font-size: 14px;
  line-height: 1;
  display: inline-block;
}

.btn-unbind:hover {
  background: #d1242f;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
}

/* 圖片預覽遮罩 */
.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.image-preview-modal {
  background: white;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

.image-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #d2d2d7;
  background: #f5f5f7;
}

.image-preview-title {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
}

.image-preview-close {
  background: #ff3b30;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;

  /* 新增以下兩行修正變形 */
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
}

.image-preview-close:hover {
  background: #d1242f;
  transform: scale(1.1);
}


.image-preview-content {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.image-preview-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-preview-info {
  padding: 12px 20px;
  background: #f5f5f7;
  border-top: 1px solid #d2d2d7;
  font-size: 12px;
  color: #86868b;
  font-family: 'SF Mono', 'Monaco', monospace;
}

.image-preview-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 80px;
  gap: 16px;
}

/* 響應式：會員區域 */
@media (max-width: 767px) {
  .member-info {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .member-item {
    padding: 12px;
  }
  
  .member-value {
    font-size: 13px;
  }
  
  .selected-list {
    flex-direction: column;
  }
  
  .selected-tag {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 575px) {
  .member-section {
    margin-bottom: 24px;
  }
  
  .member-list {
    max-height: 300px;
  }
  
  .member-item {
    padding: 10px;
  }
  
  .member-label {
    font-size: 11px;
  }
  
  .member-value {
    font-size: 12px;
  }
  
  .btn-bind {
    padding: 14px 20px;
    font-size: 15px;
  }
  
  .history-item {
    padding: 12px;
  }
  
  .history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .history-header-left {
    width: 100%;
  }
  
  .history-richmenu-id {
    font-size: 11px;
  }
  
.btn-preview-image {
  padding: 3px 6px;
  min-width: 28px;
  height: 22px;
  display: inline-flex;              /* 保證尺寸與內容一致 */
  align-items: center;               /* 垂直置中 icon 或文字 */
  justify-content: center;           /* 水平置中 */
  flex: 0 0 auto;                    /* 防止被 flex 拉伸 */
  box-sizing: border-box;            /* 確保 padding 不改變實際尺寸 */
  border: none;                      /* 若原本沒有邊框 */
  border-radius: 4px;                /* 輕微圓角，可依需求調整 */
  background: #f5f5f5;               /* 預設背景，可依主題改色 */
  color: #333;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-preview-image:hover {
  background-color: #e0e0e0;
  transform: scale(1.05);
}

.btn-preview-image .btn-icon {
  font-size: 12px;
  line-height: 1;
  display: inline-block;
}

  
  .history-time {
    font-size: 11px;
  }
  
  .btn-unbind {
    width: 100%;
    justify-content: center;
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .btn-unbind .btn-icon {
    font-size: 16px;
  }
  
  .image-preview-modal {
    max-width: 95vw;
    max-height: 95vh;
  }
  
  .image-preview-content {
    padding: 12px;
  }
  
  .image-preview-content img {
    max-height: 60vh;
  }
  
  .image-preview-header {
    padding: 12px 16px;
  }
  
  .image-preview-title {
    font-size: 14px;
  }
  
  .image-preview-close {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 18px;
  }
}
