/* 字型宣告：避免 Windows 將粗體渲染為過粗的 Arial Black */
@font-face {
  font-family: "CLC Arial";
  src: local("Arial");
  font-weight: 100 549;
}
@font-face {
  font-family: "CLC Arial";
  src: local("Arial Bold"), local("Arial");
  font-weight: 550 1000;
}

:root {
  --clc-pad: 16px;
  --primary: #007E8A;
  --primary-hover: #006670;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --input-bg: #ffffff;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;
}

html.dark {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #334155;
  --input-bg: #0f172a;
  --success-bg: #064e3b;
  --success-border: #059669;
  --success-text: #d1fae5;
}

@media (min-width: 768px) {
  :root {
    --clc-pad: 24px;
  }
}

* {
  box-sizing: border-box;
  font-family: "CLC Arial", Arial, "Microsoft JhengHei", "PingFang TC", sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding: env(safe-area-inset-top) var(--clc-pad) env(safe-area-inset-bottom);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.page {
  width: 100%;
  max-width: 680px;
  padding-top: 24px;
  padding-bottom: 32px;
}

@media (min-width: 768px) {
  .page {
    padding-top: 48px;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

@media (min-width: 768px) {
  .card {
    padding: 28px;
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 6px;
  margin-top: -4px;
  margin-right: -6px;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background-color 0.2s;
}

.icon-btn:hover {
  background: rgba(128, 128, 128, 0.12);
}

.icon-btn:active {
  transform: scale(0.95);
}

.field {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}

/* 手機輸入框一律 16px，避免 iOS 自動放大畫面 */
input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
}

@media (min-width: 768px) {
  input {
    font-size: 14px;
  }
}

input:focus {
  border-color: var(--primary);
}

.btn-primary {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-box {
  margin-top: 20px;
  padding: 14px;
  border-radius: 10px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.result-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-row {
  display: flex;
  gap: 8px;
}

.result-row input {
  font-weight: 700;
}

.btn-copy {
  min-width: 76px;
  min-height: 44px;
  padding: 0 14px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* Dialog 對話框（手機不切邊、底部按鈕固定） */
.dialog {
  width: calc(100% - 32px);
  max-width: 420px;
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  overflow: hidden;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.dialog-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.dialog-content {
  padding: 16px;
  overflow-y: auto;
}

.field-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.dialog-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
  position: sticky;
  bottom: 0;
}

/* Toast 輕提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: #111827;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: calc(100vw - 32px);
  text-align: center;
}

html.dark .toast {
  background: #f8fafc;
  color: #0f172a;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
