:root {
  --navy: #0b2545; --red: #c62828; --bg: #f4f6f9; --card: #fff; --text: #1b1f24;
  --muted: #5f6b7a; --line: #d9dee5; --accent: #1e5aa8; --on: #e3edf9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 16px 0 8px; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; cursor: pointer; color: var(--text); }
button:hover { border-color: #b7c0cc; }
button.on { background: var(--on); border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
button.danger { color: var(--red); }
button.link { border: 0; background: none; color: var(--accent); padding: 2px 6px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; min-width: 0; }
/* One look for every dropdown: our own arrow with clear space between the text and the arrow (the browser's own arrow sat on the text). */
select { -webkit-appearance: none; appearance: none; padding-right: 32px; text-overflow: ellipsis;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; background-size: 12px 8px; }
select:disabled { background-color: #f3f4f6; }
textarea { width: 100%; }
.s-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 4px; }
.s-search { position: relative; flex: 1 1 220px; max-width: 360px; }
.s-search input { width: 100%; padding-right: 34px; }
.s-search .s-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 4px 8px; color: var(--muted); font-size: 16px; line-height: 1; }
.tbl .nm { font-weight: 600; }
.tbl .nm-edit { margin-left: 6px; padding: 2px 8px; font-size: 12px; }
.top { position: relative; display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--navy); color: #fff; }
.brand-link { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #fff; padding: 4px; border-radius: 8px; cursor: pointer; }
.brand-link:focus-visible, .top .tab:focus-visible, .menu-btn:focus-visible, .user-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.top nav { display: flex; gap: 4px; }
.top .tab { background: transparent; color: #fff; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 12px; font-weight: 500; opacity: .85; }
.top .tab:hover { opacity: 1; background: rgba(255,255,255,.1); }
.top .tab.on { opacity: 1; font-weight: 700; border-bottom-color: #fff; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { position: relative; font-size: 13px; }
.menu-btn, .user-btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); padding: 6px 12px; }
.menu-btn { display: none; }
.user-btn { display: flex; align-items: center; gap: 8px; max-width: 280px; }
.who-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.badge { flex: none; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.2); color: #fff; }
.badge.admin { background: #fff; color: var(--navy); }
.user-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; max-width: 300px; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.2); padding: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 20; }
.user-pop[hidden] { display: none; }
.pop-email { font-weight: 600; word-break: break-all; }
.pop-role { font-size: 12px; margin-bottom: 4px; }
.banner { background: #fff8e1; border-bottom: 1px solid #f0d58a; padding: 8px 16px; font-size: 14px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.narrow { max-width: 420px; margin: 40px auto; }
.narrow form { display: flex; gap: 8px; flex-wrap: wrap; }
.narrow input { flex: 1 1 100%; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bad { color: var(--red); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input { flex: 1 1 200px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.drill-card { text-align: left; padding: 10px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.drill-card .pic svg, .thumb svg, .print-pic svg { width: 100%; height: auto; display: block; }
.drill-card .name, .p-item .name, .prac-row .name { font-weight: 600; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 12px; background: #eef1f5; border-radius: 6px; padding: 1px 8px; color: var(--muted); }
.tag.club { background: #fde8e8; color: var(--red); }
.fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.fields label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 3px; }
.fields label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
label.block { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
.toolbar { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; }
.toolbar button { padding: 6px 10px; font-size: 14px; }
.sep { width: 8px; }
.colors { display: flex; gap: 6px; margin: 6px 0 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; padding: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 2px var(--accent); }
.rink-wrap { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; }
#rink { width: 100%; height: auto; display: block; touch-action: none; user-select: none; -webkit-user-select: none; aspect-ratio: 200 / 85; }
#rink.readonly { pointer-events: none; }
.list { display: flex; flex-direction: column; gap: 8px; }
.prac-row { text-align: left; display: flex; flex-direction: column; padding: 12px; }
.p-item { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.p-item .num { font-weight: 700; width: 20px; text-align: center; color: var(--muted); }
.p-item .thumb { width: 130px; flex: none; }
.p-item .grow { flex: 1; min-width: 0; }
.mins { width: 64px; }
.minlabel { font-size: 13px; color: var(--muted); white-space: nowrap; }
.ctrls { display: flex; gap: 4px; }
.ctrls button { padding: 4px 8px; }
.total { font-weight: 600; }
.share { border-top: 1px solid var(--line); margin-top: 14px; }
.share ul { list-style: none; padding: 0; margin: 6px 0; }
.share li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
#print-area { display: none; }
@media (max-width: 640px) {
  .p-item { flex-wrap: wrap; }
  .p-item .thumb { width: 100%; order: 5; }
  .p-item .grow { flex: 1 1 calc(100% - 40px); }   /* name and notes get the full row; minutes, station and buttons wrap under it */
  .brand { font-size: 15px; }
  .menu-btn { display: block; }
  .user-btn .who-email { display: none; }
  .top nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; background: var(--navy); border-top: 1px solid rgba(255,255,255,.2); padding: 6px 16px 10px; z-index: 20; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
  .top nav.open { display: flex; }
  .top .tab { text-align: left; border-bottom: 0; border-left: 3px solid transparent; padding: 12px; }
  .top .tab.on { border-left-color: #fff; background: rgba(255,255,255,.12); }
}
/* Tablet width: the Admin header (five tabs, Alerts, email, badge) is wider than 768 px, so it uses the same menu button as the phone. */
@media (min-width: 641px) and (max-width: 860px) {
  .menu-btn { display: block; }
  .user-btn .who-email { display: none; }
  .top nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; background: var(--navy); border-top: 1px solid rgba(255,255,255,.2); padding: 6px 16px 10px; z-index: 20; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
  .top nav.open { display: flex; }
  .top .tab { text-align: left; border-bottom: 0; border-left: 3px solid transparent; padding: 12px; }
  .top .tab.on { border-left-color: #fff; background: rgba(255,255,255,.12); }
}
/* Print and PDF options on the practice screen */
.printbox { border-top: 1px solid var(--line); margin-top: 14px; }
.printbox label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 3px; }
.printbox label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.p-item input.mins[placeholder] { width: 56px; }
@media print {
  @page { margin: 0.5in; }
  body { background: #fff; }
  .top, .banner, main { display: none !important; }
  #print-area { display: block; padding: 0 10px; }
  .print-item { break-inside: avoid; margin-bottom: 18px; }
  .print-pic { max-width: 640px; border: 1px solid #ccc; }
  .print-notes { white-space: pre-wrap; }
  /* Full Width: every diagram gets its own page, as big as the page allows, the words under it */
  .lay-full .print-step { break-after: page; break-inside: avoid; }
  .lay-full .print-step:last-child { break-after: auto; }
  .lay-full .print-pic { max-width: none; }
  .lay-full .print-pic svg { max-height: 6.3in; }
  /* Grid: two columns, two rows a page (about four drills) */
  .lay-grid .print-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.15in; }
  .lay-grid .tile { height: 4.1in; overflow: hidden; border: 1px solid #bbb; padding: 6px 8px; break-inside: avoid; }
  .lay-grid .tile h2 { font-size: 13px; margin: 0 0 2px; }
  .lay-grid .tile .meta { font-size: 11px; margin: 0 0 4px; color: #444; }
  .lay-grid .tile .print-pic { max-width: none; }
  .lay-grid .tile .print-pic svg { max-height: 2in; }
  .lay-grid .tile .cap { font-size: 11px; line-height: 1.25; margin: 4px 0 0; white-space: pre-wrap; }
  /* Cheat Sheet: one text page */
  .cheat { font-size: 10pt; line-height: 1.3; color: #000; }
  .cheat.s9 { font-size: 9pt; } .cheat.s8 { font-size: 8pt; } .cheat.s7 { font-size: 7pt; }
  .cheat h1 { font-size: 18pt; margin: 0; }
  .cheat .cheat-sub { font-size: 11pt; margin: 2px 0 10px; }
  .cheat .cheat-notes { margin-bottom: 0.6em; }
  .cheat .cheat-group { border-bottom: 0.5pt solid #dcdee1; font-weight: 700; padding: 0.1em 4px; margin-top: 0.6em; break-after: avoid; }
  .cheat .cheat-row { display: flex; gap: 8px; margin-top: 0.15em; break-inside: avoid; }
  .cheat .ct { flex: none; width: 56px; font-weight: 700; }
  .cheat .cm { flex: none; width: 42px; }
  .cheat .cb { flex: 1; min-width: 0; }
  .cheat .cn { font-weight: 700; }
  .cheat .cl { font-size: 0.95em; }
}

.dlg { border: 1px solid var(--line); border-radius: 12px; padding: 18px; max-width: 380px; width: calc(100% - 32px); }
.dlg::backdrop { background: rgba(0, 0, 0, .4); }
.dlg h2 { margin-top: 0; }
.dlg input { width: 100%; margin: 8px 0; }

#step-tabs button.add { border-style: dashed; }
#rink.endzone { max-width: 520px; margin: 0 auto; }
.fields label.grow { flex: 1 1 260px; }
.fields label.grow input { width: 100%; }
.logo { height: 34px; width: 34px; border-radius: 6px; }

/* Footer (legal links), pinned to the page bottom */
body { min-height: 100vh; display: flex; flex-direction: column; }
main { width: 100%; }
.site-footer { margin-top: auto; display: flex; gap: 8px 18px; flex-wrap: wrap; justify-content: center; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.site-footer nav { display: flex; gap: 14px; }
.site-footer a { color: var(--accent); }
@media print { .site-footer { display: none !important; } }
/* Settings screen */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-size: 13px; color: var(--muted); font-weight: 600; }
.tbl .tag { margin-left: 6px; }
.tbl td.acts { white-space: normal; min-width: 150px; }
.tbl .nm-add { padding: 2px 8px; font-size: 12px; color: var(--muted); }
.gap-top { margin-top: 16px; }
.audit { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.audit li { padding: 4px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#s-new-email { flex: 1 1 240px; }

/* View Only: hide the buttons that make or change things (the database blocks them too) */
body.viewer #new-drill, body.viewer #folder-tools, body.viewer #new-practice, body.viewer #save-drill,
body.viewer #add-to-practice, body.viewer #delete-drill, body.viewer #save-practice, body.viewer #delete-practice,
body.viewer #share-box, body.viewer #nav .tab[data-view="draw"] { display: none !important; }

/* New-version bar (top of page) */
.update-bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 12px; background: var(--accent); color: #fff; font-size: 14px; }
.update-text { min-width: 0; }
.update-bar button { background: #fff; color: var(--navy); border-color: #fff; padding: 3px 12px; font-weight: 600; }
.update-bar .update-close { background: transparent; color: #fff; border-color: transparent; padding: 3px 8px; font-weight: 400; }
.update-bar button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 640px) { .update-bar { font-size: 13px; padding: 6px 8px; gap: 8px; } }
@media print { .update-bar { display: none !important; } }

/* Read-only drill page (Coaches on shared drills, View Only): no editing tools */
#view-draw.view-only .ed { display: none !important; }
.readout { overflow-wrap: anywhere; }
.readout h1 { margin: 0 0 6px; }
.readout h2 { font-size: 15px; margin: 16px 0 4px; }
.readout p { margin: 4px 0; white-space: pre-line; }
.readout ul { margin: 4px 0 4px 20px; padding: 0; }
.readout .facts { color: var(--muted); font-size: 14px; }
.readout .tags { margin: 6px 0 10px; }

/* Drill approval */
.count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.status-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; background: #eef1f5; }
.status-box p { margin: 4px 0; white-space: pre-line; overflow-wrap: anywhere; }
.status-box.pending { background: #fff8e1; border-color: #f0d58a; }
.status-box.changes { background: #fdeaea; border-color: #e8b4b4; }
.notif-pop { min-width: 280px; max-width: 340px; max-height: 60vh; overflow: auto; }
.notif-list { list-style: none; margin: 6px 0; padding: 0; }
.notif-list li { border-bottom: 1px solid var(--line); }
.notif-list button { text-align: left; width: 100%; border: 0; background: none; padding: 8px 4px; border-radius: 0; overflow-wrap: anywhere; }
.notif-list button.unread { font-weight: 600; }
.notif-list .when { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
@media (max-width: 480px) {
  /* phone: logo only, no email text, so Menu, Alerts and the user badge all fit */
  .brand-link .brand { display: none; }
  .who-email { display: none; }
  .bar-right { gap: 6px; }
  .user-btn, .menu-btn { padding-left: 10px; padding-right: 10px; }
}

/* ---------- Practice blocks and stations (editor) ---------- */
.timebar { margin: 4px 0 8px; }
.timebar .total { display: inline-block; padding: 6px 10px; border-radius: 8px; background: var(--on); }
.timebar .total.bad { background: #fde8e8; color: var(--red); }
.legacy-note { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; background: #fffbea; }
.list.blocks { gap: 14px; }
.blk { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; }
.blk-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.blk-num { font-weight: 700; color: var(--muted); }
.blk-name { flex: 1 1 140px; font-weight: 600; }
.blk-clock { font-size: 13px; color: var(--muted); }
.blk-setup { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin: 8px 0 4px; }
.blk-setup label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 3px; }
.blk-setup label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 14px; padding-bottom: 7px; }
.blk-note { margin: 2px 0; }
.blk-ice { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px; margin: 8px 0 2px; max-width: 760px; }
.blk-ice.ice-half { max-width: 430px; }
.blk-ice.ice-end { max-width: 330px; }
.blk-ice svg { width: 100%; height: auto; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.ice-edit .ice-marker { cursor: grab; }
.ice-edit .ice-marker:focus { outline: none; }
.ice-edit .ice-marker:focus-visible circle:first-of-type { stroke: #1e5aa8; stroke-width: 1.2; }
.st-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.st-row { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.st-row.sel { border-color: var(--accent); background: var(--on); }
.st-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.st-drill { width: 100%; }
.st-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.st-coach { flex: 1 1 140px; max-width: 220px; }
.st-where { font-size: 13px; color: var(--muted); }
.st-thumb { width: 90px; flex: none; }
.st-thumb:empty { display: none; }
.sh-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; border-radius: 50%; color: #111; font-weight: 700; font-size: 13px; border: 1.5px solid; flex: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sh-badge.c1 { background: #f9e3e3; border-color: #c62828; } .sh-badge.c2 { background: #e0ebf8; border-color: #1565c0; } .sh-badge.c3 { background: #e2f0e3; border-color: #2e7d32; } .sh-badge.c4 { background: #fdebdb; border-color: #ef6c00; }
.sh-badge.c5 { background: #ece0f1; border-color: #6a1b9a; } .sh-badge.c6 { background: #dbf0f2; border-color: #00838f; } .sh-badge.c7 { background: #f7dfe9; border-color: #ad1457; } .sh-badge.c8 { background: #ebe3df; border-color: #5d4037; }
.sh-badge.c9 { background: #f0f0d9; border-color: #827717; } .sh-badge.c10 { background: #e0e2f2; border-color: #283593; } .sh-badge.c11 { background: #d9efec; border-color: #00695c; } .sh-badge.c12 { background: #e3e8eb; border-color: #455a64; }
@media (max-width: 640px) {
  .blk-head .blk-name { flex-basis: 100%; order: 2; }
  .st-row { flex-wrap: wrap; }
  .st-thumb { width: 100%; max-width: 280px; order: 5; }
  .st-coach { max-width: none; flex-basis: 100%; }
}
/* ---------- Block Sheets (print): calm, light, lots of white ---------- */
@media print {
  .lay-sheets .sheet { break-after: page; padding: 0.2in 0.25in; }
  .lay-sheets .sheet:last-child { break-after: auto; }
  .lay-sheets { font-size: 9.5pt; line-height: 1.4; color: #15171c; }
  .lay-sheets .sh-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #6e7378; font-size: 9pt; }
  .lay-sheets .sh-top h1 { font-size: 9pt; font-weight: 400; margin: 0; display: inline; color: #6e7378; }
  .lay-sheets .sh-top .sh-date { display: inline; margin: 0 0 0 8px; font-size: 9pt; }
  .lay-sheets .sh-logo { width: 0.3in; height: 0.3in; opacity: 0.9; }
  .lay-sheets .sh-banner { margin: 14pt 0 0; display: block; }
  .lay-sheets .sh-banner::before { content: ''; display: block; width: 22pt; border-top: 2.5pt solid #e8781a; margin-bottom: 10pt; }
  .lay-sheets .sh-banner b { display: block; font-size: 26pt; line-height: 1.15; font-weight: 700; color: #15171c; }
  .lay-sheets .sh-banner span { display: block; font-size: 11pt; color: #6e7378; margin-top: 3pt; white-space: nowrap; }
  .lay-sheets .sh-line { margin: 2pt 0 8pt; color: #6e7378; font-size: 10pt; }
  .lay-sheets .print-notes { color: #6e7378; }
  .lay-sheets .sh-rink { text-align: center; margin: 6pt 0 10pt; }
  .lay-sheets .sh-rink svg { width: 100%; max-height: 200pt; display: block; margin: 0 auto; }
  .lay-sheets .sh-table { width: 100%; border-collapse: collapse; font-size: 9pt; margin: 4pt 0 14pt; table-layout: fixed; }
  .lay-sheets .sh-table th { font-weight: 400; color: #6e7378; font-size: 8pt; text-align: left; padding: 4pt 3pt; border-bottom: 0.5pt solid #dcdee1; }
  .lay-sheets .sh-table td { padding: 5pt 3pt; border-bottom: 0.5pt solid #dcdee1; vertical-align: top; overflow-wrap: anywhere; }
  .lay-sheets .sh-table th:nth-child(1), .lay-sheets .sh-table td:nth-child(1) { width: 30pt; }
  .lay-sheets .sh-table th:nth-child(2) { width: 30%; } .lay-sheets .sh-table th:nth-child(3) { width: 20%; } .lay-sheets .sh-table th:nth-child(4) { width: 18%; }
  .lay-sheets .sh-table .b { font-weight: 700; }
  .lay-sheets .sh-table .sh-badge, .lay-sheets .sh-dh .sh-badge { min-width: 17pt; height: 17pt; font-size: 8.5pt; border-width: 1pt; }
  .lay-sheets .sh-drill { break-inside: avoid; margin: 0 0 16pt; padding-bottom: 12pt; border-bottom: 0.5pt solid #dcdee1; }
  .lay-sheets .sh-dh { display: flex; align-items: center; gap: 8pt; font-size: 13pt; }
  .lay-sheets .sh-cols { display: flex; gap: 22pt; margin-top: 8pt; align-items: flex-start; }
  .lay-sheets .sh-left { flex: none; width: 232pt; }
  .lay-sheets .sh-left .print-pic { max-width: none; width: 232pt; border: 0; }
  .lay-sheets .sh-left .print-pic svg { max-height: 140pt; }
  .lay-sheets .sh-right { flex: 1; min-width: 0; font-size: 9.5pt; overflow-wrap: anywhere; line-height: 1.45; }
  .lay-sheets .sh-meta { margin: 0 0 2pt; color: #6e7378; font-size: 9pt; }
  .lay-sheets .sh-field { margin-top: 7pt; }
  .lay-sheets .sh-field b { display: block; font-weight: 400; font-size: 8pt; color: #6e7378; }
  .lay-sheets .sh-stepno { font-size: 8pt; color: #6e7378; margin: 3pt 0 1pt; }
  .lay-sheets .sh-cap { font-size: 8pt; color: #6e7378; margin: 3pt 0 5pt; }
  .cheat .cheat-group { display: flex; justify-content: space-between; }
  .cheat .cheat-bsub { font-size: 0.95em; padding-left: 4px; }
  .cheat .cheat-st { margin-top: 0.1em; padding-left: 8px; gap: 8px; }
  .cheat .cheat-st .cn { flex: none; width: 16px; }
  .cheat .cheat-st .cs-name { flex: 0 0 38%; font-weight: 700; }
  .cheat .cheat-st .cs-where { flex: 0 0 22%; }
  .cheat .cheat-st .cs-coach { flex: 1; }
}

/* ---------- Draw Drill screen: top bar, edit bar, big rink, tool dock, drill details ---------- */
:root { --orange: #e8781a; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.draw-card { padding: 14px; }
.drawbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.drawbar label { display: block; margin: 0; }
.drawbar input, .drawbar select { height: 42px; width: 100%; }
.db-name { flex: 1 1 240px; }
.db-name input { font-size: 16px; font-weight: 600; }
.db-pick { flex: 0 0 auto; }
.db-pick select { width: auto; max-width: 160px; }
.db-end { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.details summary::after { content: '\25BE'; margin-left: 8px; font-size: 14px; transition: transform .15s; }
.details[open] summary::after { transform: rotate(180deg); }
.details summary::-webkit-details-marker { display: none; }
.db-end button { height: 42px; padding: 0 16px; font-weight: 600; }
#save-drill { min-width: 112px; }
.draw-msg { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 40; max-width: min(560px, 92vw); margin: 0; padding: 8px 16px; font-size: 14px; background: #fff; border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 6px 20px rgba(11, 37, 69, .16); text-align: center; }
.draw-msg.bad { border-color: #e8b4b4; }
.draw-msg { pointer-events: none; }
@media (max-width: 340px) { .editbar button { font-size: 13px; padding: 0 2px; } }
.draw-msg:empty { display: none; }
#drill-status { margin-top: 10px; }
.draw-card .readout { margin-top: 10px; }

/* Rink type: one centered segmented row */
.seg { display: flex; justify-content: center; margin: 14px 0 10px; }
.seg button { border-radius: 0; margin-left: -1px; min-height: 42px; padding: 0 18px; font-weight: 500; position: relative; }
.seg button:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.seg button:last-child { border-radius: 0 10px 10px 0; }
.seg button.on { background: var(--navy); border-color: var(--navy); color: #fff; z-index: 1; }

/* Slim edit bar right above the rink */
.editbar { display: flex; justify-content: center; gap: 6px; margin: 0 0 8px; }
.editbar button { min-height: 40px; padding: 0 14px; font-size: 14px; }
.editbar button.on { background: var(--navy); border-color: var(--navy); color: #fff; }

.draw-card .rink-wrap { padding: 4px; }
#step-tabs { margin: 12px 0 4px; gap: 6px; }
#step-tabs button { min-height: 40px; padding: 0 14px; }
#step-tabs button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.draw-card label.block input { width: 100%; min-height: 42px; margin-top: 3px; }

/* Tool dock: labelled groups, big buttons */
.dock { margin: 14px 0 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfd; }
.dock-tabs { display: none; }
#tools { display: flex; flex-wrap: wrap; gap: 14px 24px; }
.tg { min-width: 0; }
.tg-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.tg-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-row button { min-height: 48px; min-width: 56px; padding: 0 14px; font-size: 15px; }
.dock button.on { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: inset 0 -3px 0 var(--orange); }
.dock .colors { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.dock .swatch { width: 40px; height: 40px; }
.dock .swatch.on { box-shadow: 0 0 0 3px var(--navy); border-color: #fff; }
button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Drill details */
.details { margin-top: 12px; border-top: 1px solid var(--line); }
.details summary { list-style: none; cursor: pointer; font-weight: 600; font-size: 16px; min-height: 48px; display: flex; align-items: center; color: var(--navy); }
.details[open] summary { margin-bottom: 4px; }

@media (max-width: 640px) {
  main:has(#view-draw:not([hidden])) { padding: 8px; }
  .draw-card { padding: 10px; border-radius: 10px; }
  /* Row 1: Name, Save Drill, More. Row 2: Age and Skill, half a row each. */
  .db-name { flex: 1 1 100px; order: 1; }
  .db-end { flex: 0 0 auto; order: 2; margin-left: 0; }
  .db-end button { padding: 0 14px; }
  .db-pick { flex: 1 1 calc(50% - 4px); order: 3; min-width: 0; }
  .db-pick select { width: 100%; max-width: none; }
  .draw-card input, .draw-card select, .draw-card textarea { font-size: 16px; }
  .drawbar input, .drawbar select, .db-end button, .seg button { min-height: 44px; height: 44px; }
  .dock .swatch { width: 44px; height: 44px; }
  #save-drill { min-width: 0; }
  .seg { margin: 12px 0 8px; }
  .seg button { flex: 1 1 0; padding: 0 4px; font-size: 14px; }
  .seg { display: flex; }
  .editbar { gap: 4px; }
  .editbar button { flex: 1 1 0; min-width: 0; padding: 0 4px; min-height: 44px; }
  #step-tabs button { min-height: 44px; }
  .dock { padding: 8px; }
  .dock-tabs { display: flex; gap: 4px; margin-bottom: 10px; background: #eceff3; border-radius: 10px; padding: 3px; }
  .dock-tabs button { flex: 1 1 0; border: 0; background: transparent; min-height: 44px; border-radius: 8px; font-weight: 500; }
  .dock-tabs button[aria-pressed="true"] { background: #fff; color: var(--navy); font-weight: 700; box-shadow: 0 0 0 2px var(--navy); }
  #tools { display: block; }
  .tg-label { display: none; }
  #tools[data-show="players"] .tg:not([data-group="players"]), #tools[data-show="objects"] .tg:not([data-group="objects"]), #tools[data-show="lines"] .tg:not([data-group="lines"]) { display: none; }
  .tg-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
  .tg-row button { min-height: 48px; padding: 0 6px; }
  .dock .colors { gap: 8px; justify-content: space-between; margin-top: 10px; padding-top: 10px; }
}
/* Phone: a small orange dot on the dock tab that holds the chosen tool */
.dock-tabs button.has-tool::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: #c2560a; vertical-align: middle; }

/* Touch screens of any width: every control at least 44px tall */
@media (pointer: coarse) {
  .drawbar input, .drawbar select, .db-end button, .seg button, .editbar button, #step-tabs button { min-height: 44px; }
  .dock .swatch { width: 44px; height: 44px; }
}

/* ---------- Wide screens (laptop, desktop, iPad landscape): tools in a column BESIDE the rink ---------- */
@media (min-width: 900px) {
  main:has(#view-draw:not([hidden])) { max-width: 1400px; }
  .draw-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
  #view-draw.view-only .draw-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "dock" "more"; grid-template-rows: auto; }
  .draw-body { grid-template-areas: "main dock" "more dock"; grid-template-rows: auto 1fr; }
  .draw-main { grid-area: main; min-width: 0; }
  .draw-more { grid-area: more; min-width: 0; }
  .draw-side { grid-area: dock; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; align-self: start; }
  /* The rink is sized by the window height as well as the width, so the rink, edit bar and step tabs fit on one screen. */
  /* --ar is the rink's real width/height (set from app.js: full 2.264, half 1.165, end zone 0.858) */
  .draw-card #rink { width: min(100%, calc((100vh - 385px) * var(--ar, 2.264))); width: min(100%, calc((100dvh - 385px) * var(--ar, 2.264))); min-width: 300px; margin-left: auto; margin-right: auto; }
  .draw-card #rink.endzone { width: min(100%, 520px, calc((100vh - 385px) * var(--ar, 0.858))); width: min(100%, 520px, calc((100dvh - 385px) * var(--ar, 0.858))); }
  .seg { margin: 10px 0 8px; }
  .editbar { margin-bottom: 6px; }
  .draw-main label.block { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
  .draw-main label.block input { flex: 1 1 auto; width: auto; margin: 0; }
  #step-tabs { margin: 8px 0 2px; }
  /* The tool panel: sticky, all three groups and the colours showing at once */
  .dock { margin: 0 0 12px; }
  .flow { order: 0; }
  .dock-tabs { display: none; }
  #tools { display: block; }
  .tg + .tg { margin-top: 6px; }
  .tg-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .tg-row button { min-width: 0; min-height: 48px; padding: 0 1px; font-size: 13px; line-height: 1.15; }
  .dock { padding: 10px; }
  .dock .colors { margin-top: 8px; padding-top: 8px; }
  .actions { padding: 8px 10px; }
  .act-quiet button { margin-top: 10px; }
  .dock .colors { gap: 8px; justify-content: space-between; }
  .dock .swatch { width: 40px; height: 40px; }
}
@media (min-width: 900px) and (pointer: coarse) { .dock .swatch { width: 44px; height: 44px; } }

/* ---------- Workflow buttons (next to Save) and the Drill actions block (replaces the old More menu) ---------- */
.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.flow button, .actions button { height: 42px; padding: 0 14px; font-weight: 500; }
.flow button.go { background: #b34f08; border-color: #b34f08; color: #fff; font-weight: 600; }
.actions { margin: 0 0 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.act-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.act-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; }
.act-row button { height: auto; min-height: 46px; padding: 4px 6px; font-size: 14px; line-height: 1.2; }
.act-quiet { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.act-quiet button { min-height: 40px; height: auto; font-size: 14px; margin-top: 14px; }
.act-quiet .quiet { border-color: transparent; background: none; color: var(--muted); text-decoration: underline; }
.act-quiet .danger { background: #fff; border-color: #e8b4b4; }
@media (max-width: 640px) {
  .flow { flex: 1 1 100%; order: 4; }
  .flow button { flex: 1 1 0; min-width: 0; height: 44px; padding: 0 8px; }
  .act-row button, .act-quiet button { min-height: 48px; }
  .actions { padding: 10px; margin-top: 10px; }
}
@media (pointer: coarse) { .flow button, .act-quiet button { min-height: 44px; } }

/* Breathing room: a gap under the top bar (and its message / status) before the rest of the screen starts */
.draw-card .draw-body { margin-top: 12px; }
.draw-card #readout-top + .draw-body, .draw-card #drill-status:not([hidden]) ~ .draw-body { margin-top: 14px; }
.draw-card .draw-more { margin-top: 4px; }
@media (min-width: 900px) { .draw-card .seg { margin-top: 0; } }

.turn-handle { cursor: grab; }
#rink.readonly .turn-handle { display: none; }
