:root {
  --bg-start: #000000;
  --bg-end: #333333;
  --text-color: #fff;
  --border-color: rgba(255,255,255,0.6);
  --radius: 14px;
  --coinlink-bg: #fff;
  --coinlink-text: #222;
  --yellow: #FFD43B;
}
body {
  min-height: 100vh;
  background: linear-gradient(to bottom, var(--bg-start), var(--bg-end));
  color: var(--text-color);
  margin: 0;
  font-family: 'Inter', sans-serif;
}
.main-flex {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding-top: 60px;
  padding-bottom: 32px;
}
.container {
  position: relative;
  max-width: 400px;
  width: 100%;
  padding: 2rem;
  background: linear-gradient(to bottom, #16161690 30%, #242424 100%);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.37);
  text-align: center;
  animation: fadeIn 0.8s ease;
  z-index: 3;
}
.header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:1.5rem;
}
.avatar {
  position:relative;
  width:80px;
  height:80px;
  border-radius:50%;
  overflow: visible;
}
.avatar img {
  border-radius: 50%;
  width:100%;
  height:100%;
  object-fit:cover;
  position:relative;
  z-index:0;
}
.avatar::after {
  content: '';
  position:absolute;
  bottom:0;
  right:0;
  width:16px;
  height:16px;
  background:var(--yellow);
  border-radius:50%;
  box-shadow: -4px 0 0 0 var(--bg-end);
  z-index:1;
}
.profile-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
}
.profile-info h1 {
  font-size:1.5rem;
  margin:0;
  font-weight:700;
}
.status {
  font-size:0.85rem;
  opacity:0.8;
  margin-top:0.25rem;
}
.links {
  display:flex;
  flex-direction:column;
  gap:0.75rem;
  margin-bottom: 1.6rem;
}
.links a {
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0.75rem 1rem;
  border:1px solid var(--border-color);
  border-radius:var(--radius);
  background:rgba(255,255,255,0.05);
  color:var(--text-color);
  text-decoration:none;
  font-weight:600;
  transition:border-color .3s, background .3s, transform .3s;
}
.links a img.icon {
  width:20px;
  height:20px;
  margin-right:0.5rem;
}
.links a:hover {
  transform:translateY(-2px);
  background:rgba(255,255,255,0.12);
  border-color:var(--text-color);
  color: #FFD43B;
}
.footer {
  font-size:0.75rem;
  opacity:0.6;
  margin-top:1.5rem;
}
.btn-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 32px auto 0 auto;
  width: 100%;
  max-width: 400px;
}
.action-btn {
  flex: 1 1 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.05);
  color: var(--text-color);
  font-size: 1.07rem;
  font-weight: 700;
  padding: 0.8rem 0.7rem;
  transition: background .2s, border .2s, color .2s;
  cursor: pointer;
  gap: 0.6em;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.10);
  text-decoration: none;
}
.action-btn svg {
  width: 22px;
  height: 22px;
  margin-right: 6px;
  display: inline-block;
  vertical-align: middle;
  fill: #FFD43B;
}
.action-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: #fff;
  color: #FFD43B;
}
/* ======== Crypto 橫向卡片排列 ======== */
.crypto-list-wrap {
  max-width: 1200px;
  margin: 40px auto 0 auto;
  padding: 0;
  text-align: center;
  animation: fadeIn 0.7s;
}
.crypto-list-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  letter-spacing: 0.01em;
}
.crypto-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 固定4欄 */
  gap: 1.5rem;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  margin-bottom: 2.2rem;
}
.crypto-card {
  background: linear-gradient(135deg, #171717 0%, #232323 100%);
  color: #fff;
  box-shadow: 0 6px 24px 0 rgba(0,0,0,0.24);
  border-radius: 18px;
  font-size: 1rem;
  min-width: 0;
  max-width: 360px;
  padding: 1.1rem 1.2rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  gap: 0.15rem;
  margin: 0 auto;
  box-sizing: border-box;
}
.crypto-card .coin-title {
  display: flex;
  align-items: center;
  font-size: 1.07rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: #fff;
  gap: 6px;
  flex-wrap: wrap; /* 允許換行 */
  width: 100%; /* 確保使用全寬 */
}
.crypto-card .coin-title .coin-link {
  display: inline-flex; /* 改為 inline-flex */
  align-items: center;
  background: var(--coinlink-bg);
  color: var(--coinlink-text) !important;
  border-radius: 8px;
  padding: 1px 10px;
  margin-left: 4px;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 1.04rem;
  transition: background 0.17s, color 0.17s;
  white-space: nowrap; /* 防止文字換行 */
  min-width: fit-content; /* 確保最小寬度適配內容 */
}
.crypto-card .coin-title .coin-link:hover,
.crypto-card .coin-title .coin-link:active,
.crypto-card .coin-title .coin-link:visited,
.crypto-card .coin-title .coin-link:focus {
  background: var(--coinlink-bg);
  color: var(--coinlink-text) !important;
  text-decoration: underline;
}
.crypto-card .coin-title .coin-link svg {
  margin-right: 6px;
  margin-bottom: -2px;
  width: 22px; height: 22px;
  fill: #FFD43B;
}
/* 自定義標籤樣式 */
.custom-label {
  margin-left: 8px; 
  padding: 2px 6px; 
  background-color: rgba(255, 193, 7, 0.2); 
  color: #ffc107; 
  border-radius: 4px; 
  font-size: 0.8em;
  white-space: nowrap; /* 防止標籤文字換行 */
  flex-shrink: 0; /* 防止標籤被壓縮 */
}

/* 可點擊的自定義標籤 hover 效果 */
a.custom-label:hover {
  background-color: rgba(255, 193, 7, 0.4);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}
.crypto-card .positive { color: #17d93a !important; }
.crypto-card .negative { color: #ff4747 !important; }
.crypto-card .holding-amount {
  color: #FFD43B;
  font-weight: 700;
}
.back-btn {
  width: 25%;
  margin: 2.4rem auto 1.6rem auto;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: none;
  background: #FFD43B;
  color: #1c1c1c;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 14px 0 rgba(0,0,0,0.14);
  transition: background 0.2s;
  display: block;
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
}
.back-btn:hover { background: #FFC700; }
/* summary 顏色 */
#cryptoSummary .positive { color: #17d93a !important; }
#cryptoSummary .negative { color: #ff4747 !important; }
@keyframes fadeIn {
  from {opacity:0; transform:translateY(20px);}
  to {opacity:1; transform:translateY(0);}
}
@media(max-width:1100px) {
  .crypto-list-wrap { max-width: 98vw;}
  .crypto-cards { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
  .crypto-card { max-width: 97vw; }
}
@media(max-width:700px) {
  .crypto-cards {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }
  .crypto-card { max-width: 97vw; }
  .back-btn { width: 95vw; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;

}

/* 價格閃爍動畫效果 */
.price-display {
  transition: all 0.3s ease;
}

.price-flash-up {
  animation: flashGreen 0.8s ease-in-out;
}

.price-flash-down {
  animation: flashRed 0.8s ease-in-out;
}

@keyframes flashGreen {
  0% { 
    background-color: transparent; 
    color: inherit; 
  }
  25% { 
    background-color: #17d93a; 
    color: #000; 
    transform: scale(1.02);
    box-shadow: 0 0 10px rgba(23, 217, 58, 0.5);
  }
  50% { 
    background-color: rgba(23, 217, 58, 0.7); 
    color: #000; 
  }
  100% { 
    background-color: transparent; 
    color: inherit; 
    transform: scale(1);
  }
}

@keyframes flashRed {
  0% { 
    background-color: transparent; 
    color: inherit; 
  }
  25% { 
    background-color: #ff4747; 
    color: #fff; 
    transform: scale(1.02);
    box-shadow: 0 0 10px rgba(255, 71, 71, 0.5);
  }
  50% { 
    background-color: rgba(255, 71, 71, 0.7); 
    color: #fff; 
  }
  100% { 
    background-color: transparent; 
    color: inherit; 
    transform: scale(1);
  }
}
