/* ==========================================================================
   麻將公會・夏季菁英競技賽 UI Design System (GEM Team Final Release)
   ========================================================================== */

/* ==========================================================================
   01. Design Tokens
   ========================================================================== */
:root {
  --color-primary: #ff5a1f;
  --color-secondary: #ffc83d;
  --color-dark: #2a0e0a;
  --color-link: #008f47;
  --color-link-hover: #f55bb9;
  --color-text: #000000;
  --color-text-muted: #777777;
  --color-red: #e80000;
  --color-title: #7851db;
  --color-note: #002aa2;

  --page-min-width: 1050px;
  --page-width: 1050px;
  --content-width: 870px;
  --content-padding-x: 90px;
  --header-height: 550px;
  --header2-height: 522px;

  --bg-body: url('images/bg_r.png') repeat top center;
  --bg-outer: url('images/bg.png') no-repeat top center;
  --bg-outer2: url('images/bg2.png') no-repeat top center;
  --bg-content: url('images/content_bg.png') repeat-y top center;
  --bg-bottom: url('images/content_bottom.png') no-repeat top center;
  --btn-width: 377px;
  --btn-height: 59px;
  --img-normal: url('images/but_01.png');
  --img-hover: url('images/but_02.png');

  --font-family-base: system-ui, -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "微軟正黑體", sans-serif;
  --font-size-base: 18px;
  --font-size-sm: 16px;
  --font-size-xs: 14px;
  --font-size-title: 24px;
  --line-height-base: 1.8em;
  --line-height-tight: 1.6em;

  --font-weight-thin: 100;
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --font-weight-black: 900;

  --card-bg: #f8f6f2;
  --card-border: #decfb9;
  --card-shadow: 0 10px 24px rgba(88, 58, 30, 0.06);
  --paper: rgba(255, 255, 255, 0.88);
  --radius: 20px;
  --shadow: 0 16px 40px rgba(93, 60, 34, 0.12);
  --line-light: #e7d6be;
  --text-brown: #3d2b1f;
  --muted-brown: #7a6857;

  --table-head-bg: #7f4d2f;
  --table-head-text: #fffaf2;
  --table-label-bg: #f2ebe1;
  --table-cell-bg: #faf7f2;
  --rank-btn-bg: #e2b15b;
  --rank-btn-bg-hover: #d7a24a;
  --rank-btn-text: #6a4318;

  --theme-dark-text: #fff6ee;
  --theme-dark-muted: #ffd5b7;
  --theme-dark-gold: #ffd77a;
  --theme-dark-line: rgba(255, 185, 108, 0.18);
  --theme-dark-shadow: 0 18px 48px rgba(0,0,0,.35);
  --surface-card: #ffffff;
  --surface-soft: #f5efe6;
  --border-default: #e7d6be;
  --shadow-sm: rgba(0,0,0,0.05);
  --accent-primary: #ff9f43;

  --text: #fff6ee;
  --muted: #ffd5b7;
  --gold: #ffd77a;
  --line: rgba(255, 185, 108, 0.18);
  --shadow: 0 18px 48px rgba(0,0,0,.35);
}

/* ==========================================================================
   02. Base & Reset
   ========================================================================== */
/* 🚨 關鍵修復 1：強迫 html 也要有最小寬度，底層才不會露餡 */
html, body { margin: 0; padding: 0; width: 100%; height: 100%; min-width: var(--page-min-width); }
body {
  background: var(--bg-body);
  background-size: auto; font-family: var(--font-family-base);
  font-size: var(--font-size-base); color: var(--color-text);
  position: relative;
}
img { border: 0; }
a { color: var(--color-link); font-weight: bold; text-decoration: none; }
a:hover { color:#002aa2;}

/* ==========================================================================
   03. Typography & Utilities
   ========================================================================== */
.red { color: var(--color-red); }
.title { font-size: var(--font-size-title); line-height: 24px; font-weight: bold; color: var(--color-title); }
.note { font-size:var(--font-size-sm);  color: var(--color-note); }
.stxt { font-size: var(--font-size-sm); }
.tb_stxt { color: var(--color-text-muted); font-size: var(--font-size-xs); line-height: var(--line-height-base); }
.clear { clear: both; }
.narrow { width: min(960px, calc(100% - 32px)); margin: 0 auto; }

/* ==========================================================================
   04. Legacy Layout & Structure
   ========================================================================== */
#outer, #outer2 {
  width: 100%; 
  min-width: var(--page-min-width); /* 🚨 關鍵修復 2：外層底圖綁定 1050px */
  color: var(--color-text); line-height: var(--line-height-base);
  font-family: var(--font-family-base); font-size: var(--font-size-base);
  background-size: auto; background-position: top center;
  margin: 0; padding: 0;
  display: flow-root; 
}
#outer { background: var(--bg-outer); }
#outer2 { background: var(--bg-outer2); }

#outer #weapper, #outer2 #weapper { 
  width: var(--page-width); 
  margin: 0 auto; 
  position: relative;
}
#outer #weapper #content, #outer2 #weapper #content {
  width: var(--content-width); padding: 0 var(--content-padding-x); position: relative;
  background: var(--bg-content); margin-bottom: -2px;
  display: flow-root; 
}
#outer #weapper #content::before, #outer2 #weapper #content::before {
  content: "";
  display: table;
}
#outer #weapper #notice, #outer2 #weapper #notice { width: var(--content-width); visibility: inherit; font-size: var(--font-size-sm); line-height: var(--line-height-base); }
.bottom { height: 180px; margin-right: auto; margin-left: auto; background: var(--bg-bottom); background-size: auto; background-position: top center; background-repeat: no-repeat; min-width: var(--page-min-width); }

/* ==========================================================================
   05. Header & Navigation
   ========================================================================== */
#outer #weapper #header { 
  width: var(--page-width); 
  height: var(--header-height); 
  position: relative; 
  background: url('images/header.png') no-repeat top left; 
  margin: 0; padding: 0;
}
#outer2 #weapper #header2 { width: var(--page-width); height: var(--header2-height); position: relative; margin: 0; padding: 0;}
#logo { display: block; width: 136px; height: 100px; position: absolute; top: 0; left: 9px; z-index: 9; }
#logo a { display: block; width: 136px; height: 100px; }

/* 🚨 關鍵修復 3：解決加總溢出 (89 + 960 = 1049px，安全) */
#menu { width: 960px; height: 80px; position: absolute; top: 390px; left: 89px; margin: 0; padding: 0; }

.icon01 { display: block; width: 117px; height: 35px; position: absolute; top: 30px; right: 0; }
.icon01 a { display: block; width: 117px; height: 55px; background: url('images/icon_01.png') no-repeat; }
.icon01 a:hover { background-image: url('images/icon_01_2.png'); }
.icon02 { display: block; width: 117px; height: 35px; position: absolute; top: 75px; right: 0; }
.icon02 a { display: block; width: 117px; height: 35px; background: url('images/icon_02.png') no-repeat; }
.icon02 a:hover { background-image: url('images/icon_02_2.png'); }

.but01, .but02 { display: block; position: absolute; top: 10px; width: var(--btn-width); height: var(--btn-height); margin: 0; padding: 0;}
.but01 { left: 12px; } .but02 { left: 493px; }
.but01 a, .but02 a { display: block; width: 100%; height: 100%; background-repeat: no-repeat; background-position: 0 0; background-size: 100% 100%; text-decoration: none; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.but01 a { background-image: var(--img-normal); opacity: 1; cursor: default; }
.but02 a { background-image: var(--img-hover); opacity: 0; transition: opacity 0.2s linear; }
.but02:hover a { opacity: 1; }

.but07 { display: block; width: 74px; height: 87px; position: absolute; top: 305px; right: 44px; }
.but07 a { display: block; width: 74px; height: 87px; background: url('images/but_07_1.png') no-repeat; }
.but07 a:hover { background-image: url('images/but_07_2.png'); }

.but_casual { width: 100%; padding: 20px 0 10px; }
.but_casual .go1 a, .but_casual .go2 a, .but_casual .go3 a { display: block; float: left; width: 122px; height: 41px; background-repeat: no-repeat; background-position: top left; margin: 0 auto; }
.but_casual .go1 a { background-image: url('images/go_01.png'); }
.but_casual .go2 a { background-image: url('images/go_02.png'); }
.but_casual .go3 a { background-image: url('images/go_03.png'); }
.but_casual .go1 a:hover, .but_casual .go2 a:hover, .but_casual .go3 a:hover { background-position: 0 -41px; }

/* ==========================================================================
   06. Content Modules - Beige Theme
   ========================================================================== */
.content-section { padding: 0 0 18px; }
.content-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.content-card { 
  background: linear-gradient(180deg, rgba(42, 14, 10, 0.95) 0%, rgba(20, 5, 5, 0.98) 100%);
  border: 1px solid rgba(255, 200, 61, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(255, 90, 31, 0.1);
  border-radius: 12px;
  padding: 30px;
  color: #fffaf2; 
  box-sizing: border-box; 
  overflow: hidden;       
  margin-bottom: 24px;    
}

.content-section-title { margin: 0 0 20px; font-size: 26px; line-height: 1.35;  color: #ffc83d; font-weight: bold; border-left: 8px solid #c96d4f; padding-left: 14px; }
.panel-box { background: #efe6d7; border: 1px solid #dcc8ae; border-radius: 14px; padding: 18px; }
.panel-box h3 { margin: 0 0 12px; font-size: 20px; color: #9b5d28; }
.panel-box p { margin: 0 0 10px; line-height: 1.85; color: #4f3c2d; }
.content-list { margin: 0; padding-left: 24px; line-height: 1.95; color: #4f3c2d; }

/* ==========================================================================
   07. Tables 
   ========================================================================== */
.table-wrap { width: 100%; box-sizing: border-box; border: 1px solid #dcc8ae; border-radius: 14px; overflow: hidden;}
.table-wrap table, .event-table, table { width: 100%; border-collapse: collapse; box-sizing: border-box; min-width: 760px; }

th, td, .table-wrap th, .table-wrap td { 
  border: 1px solid #dcc8ae; 
  padding: 16px 10px; 
  box-sizing: border-box; 
  text-align: center; 
  vertical-align: middle; 
}
th { 
  background: linear-gradient(180deg, #7c3a2a, #5b2e24); 
  color: #fff7ef; 
  font-weight: 800; 
  font-size: 18px;
  line-height: 1.4;
}
td { background: #fffaf4; font-size: 16px; color: var(--text-brown); }
tr:nth-child(even) td { background: #fffaf4; }

.schedule-table .date-txt { font-size: var(--font-size-sm); font-weight: normal; color: #e7d6be; display: block; margin-top: 4px; }
.schedule-table .row-header { background: #f2ebe1; font-weight: 800; color: #5b2e24; text-align: center; padding: 14px 10px; }
.schedule-table th.holiday-col { color: #ffe38f; }
.schedule-table td.holiday-col { background: linear-gradient(135deg, #a30000 0%, #d80000 100%) !important; color: #ffe38f !important; font-weight: 900 !important; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7); }

/* ==========================================================================
   08. Legacy Reward Modules
   ========================================================================== */
.reward-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.reward-item { border-radius: 18px; padding: 18px 16px; text-align: left; border: 1px solid rgba(120, 92, 60, 0.08); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25); }
.reward-item strong { display: block; margin-bottom: 8px; font-size: 18px; color: #fff8ef; line-height: 1.4; }
.reward-item span { display: block; font-size:var(--font-size-sm);  color: #fff8ef; font-weight: bold; line-height: 1.5; }
.rank1 { background: linear-gradient(135deg, #c9972f 0%, #b27a20 100%); }
.rank2 { background: linear-gradient(135deg, #aeb8c4 0%, #97a3b1 100%); }
.rank3 { background: linear-gradient(135deg, #cd8346 0%, #b26833 100%); }
.rank4 { background: linear-gradient(135deg, #be6050 0%, #a34233 100%); }

.convert-wrap--two-col { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: start; }
.convert-box { background: #efe2cc; border: 1px solid #dcc8ae; border-radius: 18px; padding: 0; overflow: hidden; }
.convert-box h3 { margin: 0; padding: 16px 18px; font-size: 18px; color: #7a552f; background: #eadbc1; border-bottom: 1px solid #dcc8ae; }
.convert-box .table-wrap { border: 0; border-radius: 0; background: transparent; }

/* ==========================================================================
   09. Modern Dark Theme Components
   ========================================================================== */
/* 🚨 關鍵修復 4：TopBar 和 Footer 也要確保不斷邊 */
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); background: rgba(18, 4, 3, .72); border-bottom: 1px solid rgba(255,255,255,.06); min-width: var(--page-min-width); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 72px; }
.logo { font-weight: 900; letter-spacing: .08em; color: var(--theme-dark-gold); }
.top-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.top-btn { padding: 10px 16px; border-radius: 999px; background: linear-gradient(180deg, #68d1ff, #237cce); color: #fff; font-weight: 700; box-shadow: 0 6px 20px rgba(33, 112, 188, .35); }

.link-stack { display: flex; flex-direction: row; justify-content: center; gap: 18px; margin-top: 14px; }
.cta, .link-btn, .rank-link { position: relative; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 900; letter-spacing: 0.05em; text-decoration: none; white-space: nowrap; border: none; cursor: pointer; overflow: hidden; z-index: 1; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }
.cta:not(.link-btn-tb), .link-stack .link-btn { font-size: var(--font-size-title); padding: 0px 36px; min-height: 60px; }

.cta.primary, .rank-link { background: linear-gradient(180deg, #ffbf00 0%, #ff7d00 50%, #e67e22 100%); color: #fffdf5; text-shadow: 0 1px 2px rgba(130, 50, 0, 0.9), 0 2px 4px rgba(0, 0, 0, 0.4); box-shadow: 0 8px 20px rgba(230, 126, 34, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -3px 0 rgba(184, 88, 0, 0.4), 0 0 0 1px #cc7000; }
.cta.primary:hover, .rank-link:hover { transform: translateY(-3px) scale(1.02); color: #ffffff; text-shadow: 0 1px 2px rgba(150, 60, 0, 0.9), 0 3px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 14px 28px rgba(255, 159, 67, 0.5), 0 0 16px rgba(255, 227, 143, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.6), inset 0 -3px 0 rgba(184, 88, 0, 0.3), 0 0 0 1px #e67e22; }

.cta.secondary, .link-btn.ghost { background: linear-gradient(180deg, #2b5c6b 0%, #113440 100%); color: #ffffff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.15), inset 0 -3px 0 rgba(0, 0, 0, 0.5), 0 0 0 1px #3b7b8e; }
.cta.secondary:hover { transform: translateY(-3px) scale(1.02); color: #e0f7fa; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.6), 0 0 16px rgba(59, 123, 142, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.4), 0 0 0 1px #50a3bd; }

.cta::after,.rank-link::after { content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%); transform: skewX(-25deg); transition: all 0.75s cubic-bezier(0.19, 1, 0.22, 1); z-index: 2; pointer-events: none; }
.cta:hover::after, .rank-link:hover::after { left: 200%; }
.cta:active,  .rank-link:active { transform: translateY(1px) scale(0.98); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0,0,0,0.5); transition: all 0.1s ease; }

.link-btn{ background: linear-gradient(180deg, #ffd979, #ff9f43); color: #4b1800; box-shadow: 0 12px 28px rgba(255, 146, 45, .25); padding: 8px 14px; font-size: var(--font-size-sm); display: inline-flex; align-items: center; justify-content: center; padding: 5px 22px; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.link-btn:hover{ background: #efd38d; color: #6f4515; }

.section-dark { padding: 88px 0; }
.card-dark { background: linear-gradient(180deg, rgba(44,13,9,.92), rgba(27,8,7,.92)); border: 1px solid var(--theme-dark-line); border-radius: 28px; padding: 28px; box-shadow: var(--theme-dark-shadow); color: var(--theme-dark-text); }
.section-tag { display: inline-block; margin-bottom: 14px; font-size:var(--font-size-sm); font-weight: 800; letter-spacing: .12em; color: var(--theme-dark-gold); }
.section-head { margin-bottom: 28px; }
.section-head.center { text-align: center; }
.section-head h2 { margin: 0 0 14px; font-size: clamp(30px, 4vw, 44px); color: var(--theme-dark-text); }
.section-head p { color: var(--theme-dark-muted); line-height: 1.9; }

.notice{margin-top: 20px ; color: #efd38d;}
.notice-box { margin-top: 22px; padding: 18px 20px; border-radius: 20px; background: rgba(255, 139, 53, 0.08); border: 1px solid rgba(255, 171, 84, .14); }
.notice-box p { margin: 0; color: var(--theme-dark-text); }

.footer { border-top: 1px solid rgba(255,255,255,.06); background: rgba(8, 2, 2, .68); color: var(--theme-dark-muted); min-width: var(--page-min-width); }
.footer-inner { min-height: 88px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }

/* ==========================================================================
   10. Royal Guild Display Cards
   ========================================================================== */
.reward-section { margin-bottom: 30px; padding-top: 20px; }
.reward-section .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 280px)); justify-content: center; gap: 20px; margin: 0 auto; }
.panel-box .section-head h2 { color: #6f4a2f; font-weight: bold; }
.panel-box .section-head p { color: #7a6857; }
.panel-box p.red{color: var(--color-red);}
.panel-box .section-tag { color: #fff; background: linear-gradient(180deg, #e80000, #a40000); padding: 4px 14px; border-radius: 6px; font-weight: bold; letter-spacing: 2px; }
.reward-section .card { background: linear-gradient(180deg, #1e0a05 0%, #120403 100%); border: 1px solid rgba(255, 215, 122, 0.15); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; align-items: center; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.reward-section .card:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8); border-color: rgba(255, 215, 122, 0.4); }
.reward-section .card-top { width: 100%; background-color: rgba(255, 215, 122, 0.05); padding: 10px 0; display: flex; justify-content: center; align-items: center; border-bottom: 1px solid rgba(255, 215, 122, 0.15); }
.reward-section .card-top .name { color: #ffd77a; font-size: 19px; font-weight: 900; letter-spacing: 2.5px; margin: 0; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }
.reward-section .canvas.spotlight { width: 100%; height: 240px; display: flex; justify-content: center; align-items: center; position: relative; background: radial-gradient(circle at center, rgba(255, 210, 112, 0.15) 0%, transparent 70%); margin-bottom: 16px; }
.reward-section .fashion-thumb { max-width: 90%; max-height: 90%; object-fit: contain; filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.6)); }
.reward-section .tag { font-size: var( --font-size-xs); font-weight: 600; letter-spacing: 1px; border-radius: 4px; border: 1px solid rgba(255, 210, 112, 0.6); background: rgba(255, 210, 112, 0.1); color: #ff9f43; padding: 3px 12px; margin-bottom: 12px; display: inline-block; text-align: center; }
.reward-section .price { font-size:var(--font-size-sm); color: #ffd5b7; font-weight: bold; line-height: 1.5; text-align: center; padding-bottom: 18px; }

/* ==========================================================================
   11. 轉轉樂資訊區
   ========================================================================== */
.panel-box.compact-center { background-color: #f8f6f2; border: 1px solid #decfb9; border-radius: 14px; padding: 15px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.panel-box.compact-center p { margin: 2px 0 !important; line-height: 1.4; color: #7a6857; }
.panel-box.compact-center h3 { margin: 0 0 5px 0; color: #3d2b1f; font-size: 20px; }
.panel-box.compact-center p.title.red { font-weight: bold; color: #e80000; }
.panel-box.compact-center strong { font-size: 24px; color: #e80000; display: block; margin: 4px 0; }
.panel-box.compact-center .link-stack { display: flex; flex-direction: row; justify-content: center; gap: 12px; margin-top: 10px; width: 100%; }

/* ==========================================================================
   12. 確保名次獎勵並排
   ========================================================================== */
.reward-grid { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: 14px !important; }

/* ==========================================================================
   13. Meta Information Grid 
   ========================================================================== */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px; 
}

.meta-item {
  padding: 20px; 
  color: #000;
  font-size: var(--font-size-base, 18px); 
  line-height: var(--line-height-base, 1.8); 
  background: linear-gradient(180deg, #fffdfa, #fff7ee);
  border: 1px solid #e7d6be;
  border-radius: 16px;
}

.meta-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: bold;
}