/* ===== Mariners Styles (Dense3 + Warm Orange Others + Edge-to-Edge Calendar) ===== */
:root { --pagew: 1000px; --border:#e5e7eb; --accent:#0099FF; }
* { box-sizing: border-box; }
html { scrollbar-gutter: stable both-edges; }
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }
body { margin:0; font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial; color:#111; background:#fff; overflow-x:hidden; }
.header-content, main.page { max-width: 1000px; margin: 0 auto; }
main.page { padding: 12px; }
@media (max-width:600px){ main.page { padding: 8px; } }
header { padding:10px 16px; border-bottom:1px solid var(--border); background:#fff; }
.header-content { display:flex; justify-content:space-between; align-items:center; height:56px; }
.logo { height:30px; display:block; }
nav a { margin-left:8px; text-decoration:none; color:#000; font-size:.7rem; font-weight:400; letter-spacing:.03em; line-height:1; display:inline-block; padding:2px 0; }
nav a:hover { text-decoration: underline; }
.hero img { width:100%; max-height:220px; object-fit:cover; border-radius:10px; display:block; }
.card { background:#fafafa; border:1px solid var(--border); border-radius:14px; padding:16px; margin:20px 0; }
@media (max-width:600px){ .card { margin:16px 0; padding:12px; } }
footer { margin-top:24px; padding:20px; font-size:12px; line-height:1.4; color:#000; border-top:1px solid var(--border); text-align:center; }
@media (max-width:600px){ footer { margin-top:20px; padding:16px; font-size:11px; } }

/* List table */
table { width:100%; border-collapse:collapse; font-size:14px; margin-top:12px; }
th, td { padding:10px; border-bottom:1px solid var(--border); vertical-align:top; }
th { font-size:12px; color:#666; text-transform:uppercase; letter-spacing:.04em; text-align:left; }
td { text-align:left; }
@media (max-width:600px){ table { font-size:13px; } th,td { padding:8px; } }

.controls { display:flex; flex-wrap:nowrap; align-items:center; gap:10px; position:sticky; top:56px; background:#fafafa; padding:8px; border-bottom:1px solid var(--border); border-top-left-radius:14px; border-top-right-radius:14px; z-index:10; min-width:0; }
.date-day { display:flex; flex-wrap:nowrap; align-items:center; gap:10px; flex:1 1 auto; min-width:0; white-space:nowrap; }
.date-day label { display:flex; align-items:center; gap:6px; font-size:13px; color:#333; white-space:nowrap; }
.date-day input[type="date"], .date-day select { flex:1 1 auto; min-width:0; max-width:100%; padding:7px 9px; border:1px solid var(--border); border-radius:10px; font-size:13px; }
@media (max-width:380px){ .date-day { gap:8px; } .date-day label { font-size:12px; gap:4px; } .date-day input[type="date"], .date-day select { font-size:12px; padding:6px 8px; } }
@media (max-width:340px){ .date-day { gap:6px; } .date-day label { font-size:11px; } .date-day input[type="date"], .date-day select { font-size:11px; padding:5px 6px; } }
@media (max-width:600px){ .controls .date-day .day-label{ display:none; } }

/* Chips - final colors */
.chip {
  display:inline-flex; align-items:center; justify-content:center; border-radius:999px;
  padding:4px 10px; font-size:13px; font-weight:700; color:#fff; min-width:0; text-align:center; line-height:1.2;
  background:#E67E22; /* default: Others */
}
.chip.mariners{ background:#0070C0; } /* M */
.chip.taku{ background:#33B96B; }     /* 卓 */
.chip.nishi{ background:#8B4513; }    /* 西 */
.chip.default{ background:#E67E22; }  /* explicit default */
@media (max-width:600px){ .chip{ padding:3px 8px; font-size:12px; } }

/* List widths */
.m1 table { table-layout: fixed; }
.m1 table td:first-child, .m1 table th:first-child { width: 20%; text-align:center; }
.m1 table td:nth-child(2), .m1 table th:nth-child(2) { width: 20%; text-align:center; }
.m1 table td:nth-child(3), .m1 table th:nth-child(3) { width: 20%; text-align:center; }
.m1 table td:nth-child(4), .m1 table th:nth-child(4) { width: 40%; text-align:left; }
.m1 table th, .m1 table td { overflow:hidden; text-overflow:ellipsis; }
.m1 td .chip { max-width: 100%; display: inline-flex; align-items:center; white-space:nowrap; }

/* Toggle buttons */
.view-toggle { margin-left:auto; display:flex; gap:8px; }
.toggle { border:1px solid var(--border); background:#fff; padding:8px 12px; border-radius:10px; cursor:pointer; font-size:13px; }
.toggle.active { background:#111; color:#fff; border-color:#111; }
@media (max-width:600px){ .toggle { padding:6px 10px; font-size:12px; } }

/* === Calendar === */
/* Edge-to-edge: remove inner padding on the calendar "card" */
.calendar.card.edgefit { padding:0; }

/* Keep headers and cells aligned */
.cal-dow-grid, .cal-cells-grid {
  display:grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

/* Weekday row (CSS Grid header) */
.cal-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 6px;
  padding:6px 8px; /* minimal header padding */
}
.cal-title {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.cal-nav { display:inline-flex; align-items:center; justify-content:center; padding:6px 10px; line-height:1; }

/* Weekday headers touch the edges */
.cal-dow-grid {
  gap:0;
  border:1px solid var(--border);
  border-bottom:none;
  border-top-left-radius:10px;
  border-top-right-radius:10px;
  overflow:hidden;
}
.cal-dow {
  text-transform:uppercase; font-size:11px; color:#666; text-align:center; padding:8px 0;
  background:#f8f8f8; border-right:1px solid var(--border);
}
.cal-dow:last-child { border-right:none; }

/* Day cells grid touches edges */
.cal-cells-grid {
  grid-template-rows: repeat(6, minmax(100px, 1fr));
  gap:0;
  border:1px solid var(--border);
  border-bottom-left-radius:10px;
  border-bottom-right-radius:10px;
  overflow:hidden;
}
.cal-cell {
  position:relative;
  background:#fff;
  border-right:1px solid var(--border);
  border-top:1px solid var(--border);
  padding:6px 6px 8px 6px;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.cal-cell:nth-child(-n+7) { border-top:none; }
.cal-cell:nth-child(7n) { border-right:none; }
.cal-cell .date { position:absolute; top:6px; right:8px; font-size:12px; font-weight:700; color:#555; }

/* Event row uses grid to protect time and let chip ellipsize */
.event {
  display:grid;
  grid-template-columns: auto 1fr; /* time | chip */
  align-items:center;
  column-gap:6px;
  font-size:12px;
  margin-top:18px;
  white-space:nowrap;
}
.event .time { font-weight:700; margin-right:0; white-space:nowrap; }
.event .chip { max-width:100%; } /* ellipsis already set above */

.more { font-size:11px; color:#666; }

/* --- Mobile edge-fit + non-truncation --- */
@media (max-width:600px){
  .cal-title { font-size:12px; }
  .cal-nav { padding:3px 6px; }

  .cal-dow { font-size:10px; padding:3px 0; }

  .cal-cells-grid { grid-template-rows: repeat(6, minmax(72px, 1fr)); }
  .cal-cell { padding:3px 3px 5px 3px; }
  .cal-cell .date { font-size:10.5px; top:3px; right:5px; }

  .event { column-gap:2px; font-size:10.5px; margin-top:14px; }
  .event .time { margin-right:0; }
  .event .chip { padding:0 4px; font-size:9.5px; }
}

/* --- Dense layout for 2 or 3 events --- */
.cal-cell.dense3 .event { column-gap:4px; font-size:11px; margin-top:14px; }
.cal-cell.dense3 .event .chip { padding:1px 6px; font-size:10px; line-height:1.05; }
.cal-cell.dense3 .event .time { margin-right:0; }

.cal-cell.dense2 .event { column-gap:5px; font-size:11.5px; }
.cal-cell.dense2 .event .chip { font-size:10.5px; padding:1px 7px; }

@media (max-width:600px){
  .cal-cell.dense3 .date { top:2px; right:4px; font-size:10px; }
  .cal-cell.dense3 .event { column-gap:1px; font-size:10px; margin-top:11px; }
  .cal-cell.dense3 .event .chip { font-size:9px; padding:0 3px; line-height:1.05; }

  .cal-cell.dense2 .event { column-gap:2px; font-size:10.5px; }
  .cal-cell.dense2 .event .chip { font-size:9.5px; padding:0 4px; }
}
