﻿* { box-sizing: border-box; }

:root{
  --bg:#040d1f;
  --line:rgba(255,255,255,.08);
  --line-2:rgba(130,170,255,.12);
  --text:#edf4ff;
  --muted:#98a9c8;
  --lime:#27e58d;
  --yellow:#ffcc00;
  --blue:#4284ff;
  --shadow:0 10px 35px rgba(0,0,0,.28);
  font-family:"Segoe UI","Noto Sans TC",Arial,sans-serif;
}

html,body{
  margin:0;
  min-height:100%;
  background:
    radial-gradient(circle at top center, rgba(87,128,255,.10), transparent 24%),
    linear-gradient(180deg,#061023 0%, #040d1f 100%);
  color:var(--text);
}

body{
  min-height:100vh;
  overflow-x:hidden;
}

a{
  color:inherit;
  text-decoration:none;
}

.app{
  min-height:100vh;
}

.topbar{
  min-height:84px;
  display:grid;
  grid-template-columns:280px 1fr 320px;
  align-items:center;
  gap:14px;
  padding:10px 16px;
  background:linear-gradient(180deg, rgba(9,20,44,.98), rgba(7,17,38,.96));
  border-bottom:1px solid var(--line);
  box-shadow:var(--shadow);
}

.topbar-left,
.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.topbar-center{
  display:flex;
  flex-direction:column;
  gap:4px;
  line-height:1.2;
  font-size:17px;
}

.status-line{
  font-size:17px;
}

.sub-line{
  font-size:14px;
}

.inline-link{
  text-decoration:underline;
}

.mono{
  font-weight:700;
}

.ok{
  color:#d6f8ff;
  font-weight:800;
}

.board-grid{
  display:grid;
  grid-template-columns:minmax(260px,.82fr) minmax(760px,1.55fr) minmax(260px,.82fr);
  gap:12px;
  padding:12px;
  min-height:calc(100vh - 84px);
  height:calc(100vh - 84px);
  overflow:hidden;
}

.team-card,
.center-card{
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015)),
    linear-gradient(180deg, #13254e 0%, #091533 100%);
  border:1px solid var(--line-2);
  border-radius:24px;
  box-shadow:var(--shadow);
  min-width:0;
  min-height:0;
}

.team-card{
  padding:20px 14px 12px;
  display:flex;
  flex-direction:column;
  height:100%;
  overflow:hidden;
}

.center-card{
  padding:16px 16px 12px;
  display:grid;
  grid-template-rows:auto auto auto 1fr;
  gap:16px;
  height:100%;
  overflow:hidden;
}

.team-top{
  display:flex;
  justify-content:flex-start;
  align-items:flex-start;
  gap:10px;
}

.name-input{
  width:160px;
  height:46px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  background:#081632;
  color:#fff;
  padding:0 14px;
  font-size:20px;
  font-weight:900;
  letter-spacing:.05em;
  text-transform:uppercase;
}

.card-divider{
  height:1px;
  background:rgba(255,255,255,.08);
  margin:12px 0 16px;
}

.score-display-wrap{
  display:flex;
  justify-content:center;
  align-items:center;
  padding:0 0 12px;
}

.score-display{
  width:min(62%,220px);
  aspect-ratio:1.55/1;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:22px;
  background:radial-gradient(circle at center, rgba(13,24,56,.65), rgba(7,18,42,.95));
  box-shadow:inset 0 0 38px rgba(0,0,0,.16);
  font-size:110px;
  font-weight:900;
  color:var(--lime);
  line-height:1;
}

.score-actions{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px;
}

.score-actions button,
.bottom-tools button,
.chip-btn,
.nav-btn{
  border:1px solid rgba(255,255,255,.09);
  background:linear-gradient(180deg, rgba(64,84,130,.55), rgba(36,52,92,.7));
  color:#f3f7ff;
  border-radius:14px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
  cursor:pointer;
}

.score-actions button{
  height:42px;
  font-size:16px;
  font-weight:800;
}

.bottom-tools{
  margin-top:auto;
  display:grid;
  gap:8px;
  padding-top:12px;
}

.bottom-tools.compact{
  grid-template-columns:1fr;
}

.bottom-tools button{
  height:38px;
  font-size:14px;
}

.main-clock-wrap{
  min-height:31vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding:0 0 10px 0;
}

.main-clock{
  font-size:clamp(150px,16vw,340px);
  line-height:.88;
  font-weight:900;
  color:#ffcc00;
  letter-spacing:-.02em;
  text-align:center;
  white-space:nowrap;
  text-shadow:
    0 0 18px rgba(255,204,0,.10),
    0 0 42px rgba(255,204,0,.06);
}

.main-clock-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:center;
}

.shot-area{
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:center;
  text-align:center;
  margin-top:4px;
  margin-bottom:6px;
}

.shot-emphasis{
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px 12px 14px;
  background:rgba(255,255,255,.03);
}

.shot-head{
  font-size:16px;
  letter-spacing:.06em;
}

.shot-clock{
  font-size:64px;
  line-height:1;
  color:var(--blue);
  font-weight:900;
  text-shadow:0 0 20px rgba(66,132,255,.12);
}

.shot-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
}

.config-panels{
  display:grid;
  gap:12px;
}

.config-box{
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
  background:rgba(10,25,60,.75);
  backdrop-filter:blur(6px);
}

.box-title{
  font-size:15px;
  font-weight:800;
  margin-bottom:10px;
}

.inline-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
}

.inline-grid.two{
  grid-template-columns:1fr 1fr;
}

.inline-grid label{
  display:grid;
  gap:6px;
  font-size:13px;
  color:#cfe2ff;
  font-weight:600;
}

.inline-grid input{
  height:36px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:#0b1837;
  color:#fff;
  padding:0 10px;
  font-size:14px;
}

.inline-actions{
  margin-top:8px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.inline-actions button{
  color:#f3f7ff !important;
}

.log-box{
  border:1px solid var(--line);
  border-radius:18px;
  background:rgba(5,17,42,.34);
  padding:12px;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}

.log-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:8px;
  font-size:15px;
}

.event-log{
  display:grid;
  gap:6px;
  align-content:start;
  overflow:auto;
  padding-right:4px;
  min-height:0;
}

.log-item{
  padding:7px 9px;
  border-radius:10px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.05);
  font-size:12px;
  color:#dce7ff;
}

.chip-btn,
.nav-btn{
  height:36px;
  padding:0 14px;
  font-size:14px;
  font-weight:800;
}

.chip-btn.strong{
  background:linear-gradient(180deg, rgba(92,116,175,.85), rgba(56,77,133,.92));
}

.chip-btn.warn{
  background:linear-gradient(180deg, rgba(159,114,38,.75), rgba(132,88,20,.85));
}

.nav-btn{
  min-width:110px;
}

.pill{
  height:34px;
  padding:0 12px;
  border-radius:999px;
  display:flex;
  align-items:center;
  gap:6px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(7,18,42,.46);
  font-size:13px;
}

button:hover{
  transform:translateY(-1px);
}

button:active{
  transform:translateY(0);
}

.ghost{
  background:rgba(23,35,68,.48)!important;
}

.display-page{
  overflow:hidden;
}

.display-board{
  min-height:100vh;
  padding:22px;
  display:grid;
  align-items:stretch;
}

.display-main{
  display:grid;
  grid-template-columns:1fr 1.2fr 1fr;
  gap:18px;
  min-height:0;
}

.display-team,
.display-center{
  border-radius:28px;
  border:1px solid var(--line-2);
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015)),
    linear-gradient(180deg, #13254e 0%, #091533 100%);
  box-shadow:var(--shadow);
  padding:24px;
}

.display-team{
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:24px;
}

.display-team-name{
  font-size:48px;
  font-weight:900;
  letter-spacing:.04em;
  text-align:center;
}

.display-team-score{
  font-size:min(24vw,280px);
  line-height:.9;
  text-align:center;
  color:var(--lime);
  font-weight:900;
}

.display-center{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:26px;
}

.display-clock{
  font-size:min(26vw,360px);
  line-height:.84;
  font-weight:900;
  color:var(--yellow);
  letter-spacing:-.03em;
  text-shadow:
    0 0 20px rgba(255,204,0,.12),
    0 0 44px rgba(255,204,0,.07);
}

.display-shot-wrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  padding:16px 28px;
  border-radius:22px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
}

.display-shot-label{
  font-size:22px;
  letter-spacing:.08em;
}

.display-shot-clock{
  font-size:96px;
  color:var(--blue);
  font-weight:900;
  line-height:1;
}

@media (max-width:1366px){
  .topbar{
    grid-template-columns:250px 1fr 250px;
  }

  .board-grid{
    grid-template-columns:minmax(220px,.78fr) minmax(560px,1.45fr) minmax(220px,.78fr);
    gap:10px;
    padding:10px;
  }

  .name-input{
    width:120px;
    height:42px;
    font-size:18px;
  }

  .score-display{
    width:min(58%,190px);
    font-size:88px;
  }

  .main-clock{
    font-size:clamp(118px,13vw,260px);
  }

  .display-team-name{
    font-size:36px;
  }

  .display-clock{
    font-size:min(22vw,280px);
  }

  .display-shot-clock{
    font-size:74px;
  }
}

@media (max-width:1180px) and (orientation:landscape){
  .topbar{
    grid-template-columns:220px 1fr 240px;
    gap:10px;
    padding:8px 10px;
  }

  .topbar-center{
    font-size:14px;
  }

  .status-line{
    font-size:15px;
  }

  .sub-line{
    font-size:12px;
  }

  .board-grid{
    grid-template-columns:minmax(180px,.72fr) minmax(420px,1.5fr) minmax(180px,.72fr);
    gap:8px;
    padding:8px;
    min-height:calc(100vh - 76px);
    height:calc(100vh - 76px);
  }

  .team-card,
  .center-card{
    border-radius:18px;
  }

  .team-card{
    padding:12px 10px 10px;
  }

  .center-card{
    padding:12px 12px 10px;
    gap:12px;
  }

  .score-display{
    width:min(56%,150px);
    font-size:74px;
    border-radius:18px;
  }

  .score-actions button{
    height:34px;
    font-size:14px;
  }

  .bottom-tools button{
    height:30px;
    font-size:12px;
  }

  .main-clock{
    font-size:clamp(94px,15vw,210px);
  }

  .main-clock-wrap{
    min-height:24vh;
  }

  .display-board{
    padding:12px;
  }

  .display-main{
    gap:12px;
  }

  .display-team,
  .display-center{
    padding:16px;
    border-radius:18px;
  }

  .display-team-name{
    font-size:26px;
  }

  .display-team-score{
    font-size:min(22vw,160px);
  }

  .display-clock{
    font-size:min(24vw,210px);
  }

  .display-shot-wrap{
    padding:10px 16px;
    border-radius:16px;
  }

  .display-shot-label{
    font-size:16px;
  }

  .display-shot-clock{
    font-size:54px;
  }
}

@media (max-width:980px) and (orientation:portrait){
  .topbar{
    grid-template-columns:1fr;
    gap:10px;
    padding:10px;
  }

  .board-grid{
    grid-template-columns:1fr;
    gap:10px;
    padding:10px;
    min-height:auto;
    height:auto;
    overflow:visible;
  }

  .team-card,
  .center-card{
    height:auto;
    overflow:visible;
  }

  .center-card{
    grid-template-rows:auto auto auto 1fr;
  }

  .team-top{
    flex-wrap:wrap;
    gap:10px;
  }

  .name-input{
    width:140px;
    height:44px;
    font-size:20px;
  }

  .score-display{
    width:min(62%,220px);
    font-size:96px;
  }

  .main-clock-wrap{
    min-height:auto;
    padding:8px 0;
  }

  .main-clock{
    font-size:clamp(86px,22vw,180px);
  }

  .inline-grid,
  .inline-grid.two{
    grid-template-columns:1fr;
  }

  .display-page{
    overflow:auto;
  }

  .display-board{
    min-height:auto;
    padding:10px;
  }

  .display-main{
    grid-template-columns:1fr;
  }

  .display-team,
  .display-center{
    padding:14px;
  }

  .display-team-name{
    font-size:28px;
  }

  .display-team-score{
    font-size:min(32vw,180px);
  }

  .display-clock{
    font-size:min(32vw,180px);
  }

  .display-shot-clock{
    font-size:56px;
  }
}

@media (max-width:680px){
  .app{
    min-width:320px;
  }

  .topbar{
    padding:8px;
    gap:8px;
  }

  .board-grid{
    padding:8px;
    gap:8px;
  }

  .team-card,
  .center-card{
    border-radius:16px;
    padding:12px 10px 10px;
  }

  .name-input{
    width:120px;
    height:40px;
    font-size:18px;
  }

  .score-display{
    width:min(70%,180px);
    font-size:72px;
  }

  .score-actions{
    grid-template-columns:repeat(2,1fr);
  }

  .score-actions button{
    height:36px;
    font-size:14px;
  }

  .bottom-tools button{
    height:34px;
    font-size:13px;
  }

  .main-clock{
    font-size:clamp(72px,20vw,132px);
  }

  .shot-clock{
    font-size:56px;
  }

  .chip-btn,
  .nav-btn,
  .pill{
    height:32px;
    padding:0 10px;
    font-size:12px;
  }

  .display-board{
    padding:8px;
  }

  .display-team,
  .display-center{
    border-radius:16px;
    padding:12px;
  }

  .display-team-name{
    font-size:22px;
  }

  .display-clock{
    font-size:min(34vw,140px);
  }

  .display-shot-clock{
    font-size:44px;
  }
}
