/* =====================================================================
   bridge★ 学習ポータル — Design System v2
   スリースターズ準拠（濃紺 #0F2537 × 金 #FFC107 / 白カード / 角丸16px）
   レイアウト: 左固定サイドバー（タブレット・PC）/ ドロワー（スマホ）
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;800;900&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary-color: #0F2537;   /* 3STARSの濃紺 */
  --primary-mid:   #1a3a5c;
  --primary-soft:  #2d5a8e;
  --accent-color:  #2f6fb0;
  --gold:          #FFC107;   /* 3STARSの金 */
  --gold-deep:     #d99e00;
  --gold-soft:     #fff5d6;
  --success-color: #2f9e6f;
  --warning-color: #d4841c;
  --danger-color:  #d14b4b;

  --text-dark:   #1b2733;
  --text-mid:    #44515f;
  --text-light:  #6b7785;
  --bg-page:     #f0f4f8;
  --bg-soft:     #e8eef5;
  --bg-white:    #ffffff;
  --border-color:#e2e8f0;

  --shadow-sm: 0 1px 3px rgba(15,37,55,.08), 0 1px 2px rgba(15,37,55,.04);
  --shadow-md: 0 4px 20px rgba(15,37,55,.08);
  --radius-sm: 10px;
  --radius:    16px;
  --sidebar-w: 232px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-dark);
  background: var(--bg-page);
  line-height: 1.75;
  font-size: 15.5px;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent-color); }
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* --- アプリシェル（サイドバー＋メイン） --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0F2537 0%, #16324b 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1200;
}
.sidebar-brand { padding: 1.6rem 1.2rem 1.1rem; text-align: center; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-stars { display: flex; justify-content: center; gap: .3rem; margin-bottom: .3rem; }
.brand-stars .fas { color: var(--gold); }
.brand-stars .s1 { font-size: .8rem; margin-top: .25rem; }
.brand-stars .s2 { font-size: 1.15rem; }
.sidebar .bs-logo { color: #fff; }
.bs-logo { font-weight: 900; color: var(--primary-color); letter-spacing: .01em; white-space: nowrap; }
.bs-logo .fa-star { color: var(--gold); font-size: .8em; margin-left: .12em; }
.brand-sub { font-size: .72rem; color: rgba(255,255,255,.65); letter-spacing: .12em; margin-top: .1rem; }

.side-nav { flex: 1; padding: 1rem .8rem; display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; }
.side-nav-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .72rem .95rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-weight: 700;
  font-size: .95rem;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.side-nav-item .fas { width: 1.3rem; text-align: center; font-size: 1.02rem; opacity: .9; }
.side-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav-item.active {
  background: rgba(255,193,7,.14);
  color: #fff;
  border-left-color: var(--gold);
}
.side-nav-item.active .fas { color: var(--gold); }

.sidebar-user {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem 1rem calc(.9rem + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user .avatar { background: var(--gold); color: var(--primary-color); }
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-info .nick { font-weight: 800; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { font-size: .7rem; color: rgba(255,255,255,.6); }
.sidebar-user .btn-ghost { color: rgba(255,255,255,.7); }
.sidebar-user .btn-ghost:hover { color: #fff; }

/* --- メイン --- */
.main {
  flex: 1;
  min-width: 0;
  padding: 1.6rem clamp(16px, 3.5vw, 40px) 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 1080px;
}
.main-wide { max-width: none; }
.no-shell .main { max-width: 640px; margin: 0 auto; padding-top: 2rem; }

/* --- モバイル上部バー・ドロワー --- */
.mobile-topbar {
  display: none;
  position: sticky; top: 0; z-index: 1100;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  padding: .6rem .9rem;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.menu-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; color: var(--primary-color); padding: .3rem .5rem;
}
.nav-overlay { display: none; }

@media (max-width: 767px) {
  .mobile-topbar { display: flex; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(15,37,55,.3);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(15,37,55,.45); z-index: 1150;
  }
  .main { padding-top: 1rem; }
}

/* --- カード（3STARS: 白・角丸16px・ホバーで金ボーダー） --- */
.card {
  background: var(--bg-white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: rgba(255,193,7,.55); box-shadow: var(--shadow-md); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .95rem 1.25rem .55rem; }
.card-head h2 { font-size: 1.05rem; font-weight: 800; color: var(--primary-color); }
.card-head h2 .fas { color: var(--gold-deep); margin-right: .3rem; font-size: .95em; }
.card-head a { font-size: .84rem; font-weight: 700; }
.card-body { padding: .2rem 1.25rem 1.1rem; }

/* --- ヒーロー（ホーム上部あいさつ） --- */
.hero {
  background: linear-gradient(135deg, #0F2537 0%, #1a3a5c 50%, #2d5a8e 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -60%; left: -30%;
  width: 160%; height: 220%;
  background: radial-gradient(circle, rgba(255,193,7,.10) 0%, transparent 55%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero .date { font-size: .82rem; color: rgba(255,255,255,.75); }
.hero h1 { font-size: 1.3rem; font-weight: 800; line-height: 1.5; }
.hero .hero-cta { margin-top: .8rem; }

/* --- ボタン --- */
.btn, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .btn-gold {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: none; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: .95rem; font-weight: 700; text-decoration: none;
  padding: .62rem 1.4rem; transition: opacity .15s, transform .05s, box-shadow .15s;
}
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { opacity: .92; }
.btn-gold { background: var(--gold); color: var(--primary-color); box-shadow: 0 2px 10px rgba(255,193,7,.35); }
.btn-gold:hover { box-shadow: 0 4px 14px rgba(255,193,7,.45); }
.btn-secondary { background: var(--bg-white); color: var(--primary-color); border: 2px solid var(--border-color); }
.btn-secondary:hover { border-color: var(--gold); }
.btn-danger { background: var(--danger-color); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-light); padding: .45rem .6rem; }
.btn:active, .btn-primary:active, .btn-secondary:active, .btn-gold:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-sm { padding: .34rem .9rem; font-size: .84rem; }

/* --- フォーム --- */
label.field { display: block; margin-bottom: .8rem; }
label.field span.label { display: block; font-size: .84rem; font-weight: 700; color: var(--text-mid); margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: .6rem .85rem; border: 2px solid var(--border-color); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 1rem; background: var(--bg-white); color: var(--text-dark);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; min-height: 4.5em; }
.form-row { display: flex; gap: .7rem; }
.form-row > * { flex: 1; }
.form-note { font-size: .8rem; color: var(--text-light); }

/* --- フッター --- */
.footer { text-align: center; color: var(--text-light); font-size: .78rem; padding-top: 1.2rem; margin-top: auto; }

/* --- スタッツ --- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.stat-tile {
  background: var(--bg-white); border: 2px solid var(--border-color); border-radius: var(--radius);
  padding: .85rem .6rem; text-align: center;
  transition: border-color .2s;
}
.stat-tile:hover { border-color: rgba(255,193,7,.55); }
.stat-tile .num { font-size: 1.65rem; font-weight: 900; color: var(--primary-color); line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-tile .num .unit { font-size: .8rem; font-weight: 700; color: var(--text-mid); margin-left: .1rem; }
.stat-tile .label { font-size: .74rem; color: var(--text-light); font-weight: 700; }
.stat-tile.gold { border-color: var(--gold); background: linear-gradient(180deg, #fffdf2, #fff); }
.stat-tile.gold .num { color: var(--gold-deep); }

/* --- 日報タイムライン --- */
.report-item { border-top: 1px solid var(--border-color); padding: .85rem 0; }
.report-item:first-child { border-top: none; }
.report-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .3rem; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-color); color: #fff; font-weight: 800; font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
}
.report-who { min-width: 0; }
.report-who .nick { font-weight: 800; font-size: .93rem; }
.report-who .meta { font-size: .74rem; color: var(--text-light); }
.report-minutes { margin-left: auto; font-weight: 800; color: var(--gold-deep); white-space: nowrap; font-size: .95rem; }
.report-subjects { display: flex; flex-direction: column; gap: .15rem; margin: .3rem 0; }
.subject-line { display: flex; gap: .5rem; font-size: .89rem; align-items: baseline; }
.subject-tag {
  flex-shrink: 0; font-size: .7rem; font-weight: 800; padding: .05rem .55rem; border-radius: 999px;
  background: var(--bg-soft); color: var(--primary-color); min-width: 3.2em; text-align: center;
}
.report-comment { font-size: .9rem; color: var(--text-mid); background: var(--bg-soft); border-radius: var(--radius-sm); padding: .45rem .75rem; margin-top: .35rem; }
.report-photos { display: flex; gap: .45rem; margin-top: .45rem; flex-wrap: wrap; }
.report-photos img { width: 82px; height: 82px; object-fit: cover; border-radius: var(--radius-sm); border: 2px solid var(--border-color); }
.report-actions { display: flex; align-items: center; gap: .9rem; margin-top: .45rem; }
.like-btn {
  background: none; border: 2px solid var(--border-color); border-radius: 999px;
  padding: .16rem .8rem; cursor: pointer; font-family: inherit; font-size: .84rem; color: var(--text-mid);
  display: inline-flex; align-items: center; gap: .35rem; transition: border-color .15s;
}
.like-btn:hover { border-color: var(--gold); }
.like-btn.liked { border-color: var(--gold); color: var(--gold-deep); font-weight: 800; background: var(--gold-soft); }
.coach-comment { border-left: 3px solid var(--gold); background: #fffbeb; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: .45rem .75rem; margin-top: .45rem; font-size: .89rem; }
.coach-comment .who { font-size: .74rem; font-weight: 800; color: var(--gold-deep); }

/* --- 計画 --- */
.plan-day { margin-bottom: .85rem; }
.plan-day h3 { font-size: .89rem; font-weight: 800; color: var(--text-mid); border-bottom: 2px solid var(--bg-soft); padding-bottom: .15rem; margin-bottom: .3rem; }
.plan-day h3.today { color: var(--primary-color); border-color: var(--gold); }
.plan-item { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; }
.plan-item .check { flex-shrink: 0; }
.plan-item .check input { width: 1.3rem; height: 1.3rem; accent-color: var(--success-color); }
.plan-item .body { min-width: 0; flex: 1; }
.plan-item .title { font-size: .93rem; font-weight: 500; }
.plan-item.done .title { text-decoration: line-through; color: var(--text-light); }
.plan-item .min { font-size: .78rem; color: var(--text-light); white-space: nowrap; }

/* --- 動画学習 --- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.course-card {
  display: block; background: var(--bg-white); border: 2px solid var(--border-color); border-radius: var(--radius);
  padding: 1rem 1.1rem; text-decoration: none; color: var(--text-dark);
  transition: border-color .2s, transform .15s, box-shadow .2s;
}
.course-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.course-card .subject { font-size: .72rem; font-weight: 800; color: var(--accent-color); letter-spacing: .06em; }
.course-card h3 { font-size: 1rem; font-weight: 800; color: var(--primary-color); line-height: 1.45; margin: .15rem 0 .5rem; }
.progress-bar { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); border-radius: 999px; }
.progress-label { font-size: .76rem; color: var(--text-light); margin-top: .25rem; display: flex; justify-content: space-between; }

.lesson-list { list-style: none; }
.lesson-list li { border-top: 1px solid var(--border-color); }
.lesson-list li:first-child { border-top: none; }
.lesson-link {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .3rem;
  text-decoration: none; color: var(--text-dark); font-size: .93rem;
  border-radius: var(--radius-sm);
}
.lesson-link:hover { background: var(--bg-soft); }
.lesson-link .day { flex-shrink: 0; min-width: 4.2em; text-align: center; font-size: .74rem; font-weight: 800; background: var(--bg-soft); color: var(--primary-color); border-radius: 999px; padding: .08rem .5rem; }
.lesson-link.watched { color: var(--text-light); }
.lesson-link.watched .day { background: #e6f6ee; color: var(--success-color); }
.lesson-link .fa-circle-check { margin-left: auto; color: var(--success-color); }
.lesson-link.current { background: var(--gold-soft); }

.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.1rem; align-items: start; }
@media (max-width: 1000px) { .watch-layout { grid-template-columns: 1fr; } }

/* --- カレンダー --- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: .2rem; }
.cal-nav h2 { font-size: 1.15rem; font-weight: 800; color: var(--primary-color); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; background: var(--border-color); border: 2px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden; }
.cal-dow { background: var(--bg-soft); text-align: center; font-size: .72rem; font-weight: 800; color: var(--text-mid); padding: .28rem 0; }
.cal-cell { background: var(--bg-white); min-height: 76px; padding: .18rem .25rem; font-size: .68rem; }
.cal-cell.other { background: var(--bg-page); }
.cal-cell .d { font-size: .74rem; font-weight: 700; color: var(--text-mid); }
.cal-cell.today-cell { outline: 3px solid var(--gold); outline-offset: -3px; }
.cal-cell.today-cell .d { color: var(--gold-deep); font-weight: 900; }
.cal-ev {
  display: block; border-radius: 5px; padding: 0 .3rem; margin-top: 2px;
  color: #fff; font-weight: 700; font-size: .64rem; line-height: 1.55;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev.cancelled { text-decoration: line-through; opacity: .55; }
.cal-ev.mine { box-shadow: 0 0 0 2px var(--gold); }
.period-band { display: inline-block; font-size: .76rem; font-weight: 800; background: var(--gold-soft); color: var(--gold-deep); border-radius: 999px; padding: .12rem .8rem; margin: 0 .3rem .3rem 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .6rem; font-size: .76rem; color: var(--text-mid); }
.cal-legend .dot { display: inline-block; width: .68em; height: .68em; border-radius: 50%; margin-right: .28em; }

/* --- お知らせ --- */
.announce-item { border-top: 1px solid var(--border-color); padding: .6rem 0; }
.announce-item:first-child { border-top: none; }
.announce-item .when { font-size: .72rem; color: var(--text-light); }
.announce-item .content { font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.announce-item .content a { word-break: break-all; }

/* --- テーブル --- */
.tablewrap { overflow-x: auto; }
table.list { border-collapse: collapse; width: 100%; font-size: .89rem; }
table.list th { text-align: left; background: var(--bg-soft); padding: .5rem .75rem; font-size: .78rem; color: var(--text-mid); white-space: nowrap; }
table.list td { padding: .55rem .75rem; border-bottom: 1px solid var(--border-color); vertical-align: middle; }

/* --- ログイン --- */
.login-wrap { max-width: 400px; margin: 2.5rem auto 0; }
.login-logo { text-align: center; margin-bottom: 1.4rem; }
.login-logo .bs-logo { font-size: 2.1rem; }
.login-logo .brand-stars { display: flex; justify-content: center; gap: .35rem; margin-bottom: .35rem; }
.login-logo .brand-stars .fas { color: var(--gold); }
.login-logo p { color: var(--text-light); font-size: .9rem; margin-top: .2rem; }

/* --- 汎用 --- */
.empty { color: var(--text-light); font-size: .9rem; text-align: center; padding: 1.2rem 0; }
.alert-error { background: #fdf0f0; color: var(--danger-color); border: 2px solid #f2cdcd; border-radius: var(--radius-sm); padding: .6rem .95rem; font-size: .9rem; margin-bottom: .9rem; }
.alert-ok { background: #eefaf4; color: var(--success-color); border: 2px solid #cdeeda; border-radius: var(--radius-sm); padding: .6rem .95rem; font-size: .9rem; }
.pill { display: inline-block; white-space: nowrap; font-size: .72rem; font-weight: 800; border-radius: 999px; padding: .06rem .65rem; background: var(--bg-soft); color: var(--primary-color); }
.pill.warn { background: #fdf3e4; color: var(--warning-color); }
.pill.ok { background: #eefaf4; color: var(--success-color); }
.mt-05 { margin-top: .5rem; } .mt-1 { margin-top: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* --- ランキング --- */
.rank-list { list-style: none; }
.rank-list li { display: flex; align-items: center; gap: .6rem; padding: .42rem 0; border-top: 1px solid var(--border-color); font-size: .92rem; }
.rank-list li:first-child { border-top: none; }
.rank-pos { flex-shrink: 0; width: 1.9em; height: 1.9em; border-radius: 50%; background: var(--bg-soft); color: var(--text-mid); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .82rem; }
.rank-pos.r1 { background: var(--gold); color: var(--primary-color); }
.rank-pos.r2 { background: #b9c4ce; color: #fff; }
.rank-pos.r3 { background: #cf9d68; color: #fff; }
.rank-val { margin-left: auto; font-weight: 800; color: var(--primary-color); font-variant-numeric: tabular-nums; }

/* --- カレンダー選択日 --- */
.cal-cell.selected-cell { outline: 3px solid var(--accent-color); outline-offset: -3px; background: #f4f8fd; }
a.cal-cell:hover { background: var(--bg-soft); }

/* --- ノート添削（Canvas） --- */
.annotate-toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pen-color {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; padding: 0;
}
.pen-color.active { border-color: var(--gold); box-shadow: 0 0 0 2px #fff inset; }
.annotate-wrap { overflow: auto; border: 2px solid var(--border-color); border-radius: var(--radius-sm); background: #f4f4f4; max-height: 72vh; }
.annotate-wrap canvas { display: block; max-width: 100%; height: auto; touch-action: none; cursor: crosshair; }
