/* ===== PR Tracker 98 — Windows 98 look ===== */
:root {
  --face: #c0c0c0;
  --light: #dfdfdf;
  --hl: #ffffff;
  --shadow: #808080;
  --dark: #0a0a0a;
  --navy: #000080;
  --blue: #1084d0;
  --teal: #008080;
  --gold: #ffd700;
  --green: #007a00;
  --tip: #ffffe1;
  --font: Tahoma, "MS Sans Serif", "Segoe UI", Geneva, Verdana, sans-serif;
  --mono: "Lucida Console", "Courier New", monospace;
  --taskbar-h: 38px;
  --out: inset -1px -1px var(--dark), inset 1px 1px var(--hl), inset -2px -2px var(--shadow), inset 2px 2px var(--light);
  --in: inset -1px -1px var(--hl), inset 1px 1px var(--shadow), inset -2px -2px var(--light), inset 2px 2px var(--dark);
  --pressed: inset -1px -1px var(--hl), inset 1px 1px var(--dark), inset -2px -2px var(--light), inset 2px 2px var(--shadow);
  --shallow: inset -1px -1px var(--hl), inset 1px 1px var(--shadow);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--teal);
  font-family: var(--font);
  font-size: 13px;
  color: #000;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--navy); }
h1, h2, h3 { margin: 0 0 8px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
hr { border: none; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--hl); margin: 6px 0; }
small, .muted { color: #444; }
[hidden] { display: none !important; }

/* ---- controls ---- */
button, .btn {
  font: inherit;
  color: #000;
  background: var(--face);
  border: none;
  border-radius: 0;
  min-height: 28px;
  padding: 4px 12px;
  box-shadow: var(--out);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
button:active, .btn:active, button.pressed {
  box-shadow: var(--pressed);
  padding: 5px 11px 3px 13px;
}
button.primary { outline: 1px solid var(--dark); outline-offset: -1px; font-weight: bold; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 1px dotted #000; outline-offset: -5px; }
button:disabled { color: var(--shadow); text-shadow: 1px 1px var(--hl); cursor: default; }
button.plain { background: none; box-shadow: none; padding: 0; min-height: 0; }
button.small, .btn.small { min-height: 22px; padding: 1px 8px; font-size: 12px; }
button.small:active { padding: 2px 7px 0 9px; }

input, select, textarea {
  font: inherit;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 0;
  padding: 4px 6px;
  min-height: 28px;
  box-shadow: var(--in);
  width: 100%;
}
select { padding-right: 2px; }
input:focus, select:focus, textarea:focus { outline: 1px dotted var(--navy); outline-offset: -4px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; box-shadow: none; accent-color: var(--navy); }
textarea { resize: vertical; }

label.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; cursor: pointer; }

fieldset {
  border: none;
  box-shadow: inset -1px -1px var(--hl), inset 1px 1px var(--shadow), inset -2px -2px var(--shadow), inset 2px 2px var(--hl);
  padding: 14px 10px 10px;
  margin: 6px 0 12px;
  min-width: 0;
}
legend { padding: 0 4px; background: var(--face); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.hint { font-size: 12px; color: #333; }

/* ---- windows ---- */
.window { background: var(--face); box-shadow: var(--out); padding: 3px; }
.title-bar {
  background: linear-gradient(90deg, var(--navy), var(--blue));
  color: #fff;
  font-weight: bold;
  padding: 3px 3px 3px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 24px;
  user-select: none;
}
.title-bar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-bar-controls { display: flex; gap: 2px; flex-shrink: 0; }
.title-bar-controls button {
  min-height: 0; width: 20px; height: 18px; padding: 0;
  font-size: 11px; font-weight: bold; line-height: 1;
}
.title-bar-controls button:active { padding: 1px 0 0 1px; }
.window-body { padding: 10px; }

.desktop {
  height: calc(100dvh - var(--taskbar-h) - env(safe-area-inset-bottom));
  padding: 16px;
  display: flex;
  justify-content: center;
  position: relative;
}
.desktop:has(.main-window:not(.minimized)) .desk-icons { display: none; }
.main-window {
  width: 100%;
  min-width: 0;
  max-width: 1000px;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.main-window.maxed { max-width: none; }
.main-window.minimized { display: none; }
.main-window > .window-body { flex: 1; overflow: auto; margin-top: 2px; -webkit-overflow-scrolling: touch; }
.status-bar { display: flex; gap: 2px; padding-top: 2px; font-size: 12px; }
.status-bar span { box-shadow: var(--shallow); padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-bar span:first-child { flex: 1; }

/* desktop icons (visible when the window is minimized) */
.desk-icons { position: absolute; inset: 16px; display: grid; grid-template-columns: repeat(auto-fill, 90px); grid-auto-rows: 86px; gap: 8px; align-content: start; }
.desk-icon { color: #fff; text-decoration: none; display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 12px; gap: 4px; text-shadow: 1px 1px #000; font-family: inherit; }
.desk-icon span { font-size: 34px; text-shadow: none; }
.desk-icon:focus { outline: 1px dotted #fff; }

/* ---- taskbar ---- */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--taskbar-h) + env(safe-area-inset-bottom));
  padding: 4px 3px calc(3px + env(safe-area-inset-bottom));
  background: var(--face);
  box-shadow: inset 0 1px var(--light), inset 0 2px var(--hl);
  display: flex; gap: 4px; align-items: stretch;
  z-index: 50;
}
.start-btn { font-weight: bold; padding: 2px 8px; }
.start-btn.pressed { padding: 3px 7px 1px 9px; }
.win-logo {
  display: inline-block; width: 16px; height: 14px;
  background:
    linear-gradient(#f03c0f, #f03c0f) 0 0 / 7px 6px no-repeat,
    linear-gradient(#5bb500, #5bb500) 8px 0 / 7px 6px no-repeat,
    linear-gradient(#1a6be0, #1a6be0) 0 7px / 7px 6px no-repeat,
    linear-gradient(#ffc400, #ffc400) 8px 7px / 7px 6px no-repeat;
  transform: skewY(-6deg);
}
.win-logo.big { width: 64px; height: 56px; background-size: 30px 26px, 30px 26px, 30px 26px, 30px 26px; background-position: 0 0, 33px 0, 0 29px, 33px 29px; }
.tasks { flex: 1; display: flex; gap: 3px; overflow: hidden; }
.task {
  flex: 0 1 140px; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 0 8px; color: #000; text-decoration: none;
  box-shadow: var(--out); background: var(--face);
  white-space: nowrap; overflow: hidden;
}
.task span { overflow: hidden; text-overflow: ellipsis; }
.task.active {
  box-shadow: var(--pressed);
  background: repeating-conic-gradient(var(--hl) 0 25%, var(--face) 0 50%) 0 0 / 2px 2px;
  font-weight: bold;
}
.tray { box-shadow: var(--shallow); padding: 0 8px; display: flex; align-items: center; gap: 8px; color: #000; text-decoration: none; font-size: 12px; white-space: nowrap; }
#trayTimer { font-weight: bold; color: var(--navy); }

.start-menu { position: fixed; left: 2px; bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom)); width: 250px; display: flex; z-index: 60; }
.start-stripe { width: 26px; background: linear-gradient(0deg, var(--navy), var(--blue)); color: #c0c0c0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; }
.start-stripe span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 18px; font-weight: bold; letter-spacing: 1px; }
.start-stripe b { color: #fff; }
.start-items { flex: 1; padding: 2px; }
.start-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 8px; color: #000; text-decoration: none;
  background: none; box-shadow: none; justify-content: flex-start; min-height: 0;
}
.start-item:active { box-shadow: none; padding: 7px 8px; }
.start-item:hover, .start-item:focus { background: var(--navy); color: #fff; outline: none; }
.start-item span { font-size: 20px; width: 24px; text-align: center; }

/* ---- tabs ---- */
.tabs { display: flex; overflow-x: auto; padding-top: 2px; position: relative; z-index: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  box-shadow: inset 1px 1px var(--hl), inset 2px 2px var(--light), inset -1px 0 var(--dark), inset -2px 0 var(--shadow);
  min-height: 26px; padding: 3px 10px; margin-top: 3px; flex-shrink: 0;
}
.tab:active { box-shadow: inset 1px 1px var(--hl), inset 2px 2px var(--light), inset -1px 0 var(--dark), inset -2px 0 var(--shadow); padding: 3px 10px; }
.tab.active { margin-top: 0; padding-bottom: 6px; margin-bottom: -2px; background: var(--face); font-weight: bold; }
.tab-panel { box-shadow: var(--out); padding: 10px; }

/* ---- lists ---- */
.listbox { background: #fff; box-shadow: var(--in); padding: 2px; }
.ex-item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center;
  padding: 6px; color: #000; text-decoration: none; border-bottom: 1px dotted var(--light);
}
.ex-item:last-child { border-bottom: none; }
.ex-item:hover, .ex-item:focus { background: var(--navy); color: #fff; outline: none; }
.ex-item:hover small, .ex-item:focus small { color: #ddd; }
.ex-item b { display: block; overflow: hidden; text-overflow: ellipsis; }
.ex-item small { display: block; font-size: 12px; }
.ex-last { font-size: 11px; text-align: right; }
.thumb {
  width: 52px; height: 52px; object-fit: cover; display: flex; align-items: center; justify-content: center;
  background: var(--face); box-shadow: var(--in); font-size: 26px; padding: 2px;
}
img.thumb { padding: 2px; background: #fff; }
.thumb.sm { width: 34px; height: 34px; font-size: 18px; }

.empty { text-align: center; padding: 24px 12px; }
.empty .big { font-size: 46px; display: block; margin-bottom: 8px; }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: #fff; box-shadow: var(--in); padding: 8px 10px; }
.stat .v { font-family: var(--mono); font-size: 22px; font-weight: bold; color: var(--navy); display: block; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .l { font-size: 11px; color: #444; text-transform: uppercase; letter-spacing: .3px; }
.stat .s { font-size: 11px; color: #444; display: block; }
.stat.gold { background: var(--tip); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* week bars */
.weeks { display: flex; gap: 4px; align-items: flex-end; height: 110px; background: #fff; box-shadow: var(--in); padding: 6px 6px 4px; }
.week { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 10px; gap: 2px; min-width: 0; }
.week i { display: block; width: 100%; max-width: 26px; background: repeating-linear-gradient(0deg, var(--navy) 0 6px, transparent 6px 8px); min-height: 2px; }
.week.now i { background: repeating-linear-gradient(0deg, var(--teal) 0 6px, transparent 6px 8px); }
.week em { font-style: normal; color: #666; }

/* progress */
.progress { height: 24px; background: #fff; box-shadow: var(--in); padding: 3px; }
.progress i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--navy) 0 9px, transparent 9px 11px); width: 0; transition: width .2s linear; }

/* ---- PR stuff ---- */
.pr-badge { display: inline-block; background: var(--gold); border: 1px solid #000; font-size: 10px; font-weight: bold; padding: 0 3px; line-height: 14px; vertical-align: middle; }
.tl { list-style: none; margin: 0; padding: 0; background: #fff; box-shadow: var(--in); }
.tl li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; padding: 7px 8px; border-bottom: 1px dotted var(--light); align-items: center; }
.tl li:last-child { border-bottom: none; }
.tl .ico { font-size: 20px; }
.tl .when { font-size: 11px; color: #555; display: block; }
.delta { color: var(--green); font-weight: bold; font-family: var(--mono); font-size: 12px; text-align: right; white-space: nowrap; }
.delta small { display: block; color: #555; font-weight: normal; font-family: var(--font); font-size: 10px; }
.tl a { color: inherit; }

.rm-table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: var(--in); font-size: 12px; }
.rm-table th, .rm-table td { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--light); }
.rm-table th { background: var(--face); font-weight: normal; box-shadow: var(--out); }

/* ---- exercise detail ---- */
.ex-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.ex-head .thumb { width: 72px; height: 72px; font-size: 36px; flex-shrink: 0; }
.ex-head h2 { margin: 0 0 2px; font-size: 18px; word-break: break-word; }
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--shadow); box-shadow: 0 1px var(--hl); }
.log-form { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 8px; align-items: end; }
.log-form label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.log-form .wide { grid-column: 1 / -1; }
.log-form .notes-rpe { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 80px; gap: 8px; }
.w-wrap { display: flex; gap: 2px; }
.w-wrap button { min-width: 32px; padding: 0 6px; }
.w-wrap button:active { padding: 1px 5px 0 7px; }
.log-form .submit { grid-column: 1 / -1; min-height: 40px; font-size: 15px; }
.target { background: var(--tip); border: 1px solid #000; padding: 6px 8px; margin-bottom: 10px; font-size: 12px; }
.target.past { background: #ffd27f; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.photo-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; }
.photo-strip img, .photo-strip .ph { width: 92px; height: 92px; object-fit: cover; flex-shrink: 0; box-shadow: var(--in); padding: 2px; background: #fff; cursor: pointer; }
.photo-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.viewer img { width: 100%; max-height: 65dvh; object-fit: contain; background: #000; display: block; }

.chart { width: 100%; height: 220px; display: block; box-shadow: var(--in); background: #fff; }
.legend { display: flex; gap: 14px; font-size: 11px; margin-top: 4px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 4px; vertical-align: middle; margin-right: 4px; }

.day { margin-bottom: 10px; }
.day-h { background: var(--navy); color: #fff; padding: 3px 8px; font-weight: bold; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.day-h small { color: #ccc; font-weight: normal; }
.day-b { background: #fff; box-shadow: var(--in); padding: 4px 8px; }
.set-line { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px dotted var(--light); flex-wrap: wrap; }
.set-line:last-child { border-bottom: none; }
.set-line .sw { font-family: var(--mono); font-weight: bold; }
.set-line .x { margin-left: auto; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-family: var(--mono); font-size: 12px; background: var(--face); box-shadow: var(--shallow); padding: 1px 5px; white-space: nowrap; }
.chip.pr { background: var(--gold); }
.log-ex { padding: 5px 0; border-bottom: 1px dotted var(--light); }
.log-ex:last-child { border-bottom: none; }
.log-ex a { font-weight: bold; text-decoration: none; display: inline-block; margin-bottom: 3px; }

/* tools */
.lcd { font-family: var(--mono); font-size: 48px; text-align: center; background: #000; color: #33ff33; padding: 6px; box-shadow: var(--in); margin-bottom: 8px; letter-spacing: 2px; }
.plates { display: flex; align-items: center; gap: 2px; min-height: 90px; padding: 8px; background: #fff; box-shadow: var(--in); overflow-x: auto; }
.bar-end { width: 40px; height: 12px; background: #999; border: 1px solid #000; flex-shrink: 0; }
.plate { border: 1px solid #000; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: bold; writing-mode: vertical-rl; }

/* ---- dialogs ---- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 12px; }
.dialog { width: 100%; max-width: 440px; max-height: calc(100dvh - 24px); display: flex; flex-direction: column; animation: pop .12s steps(3); }
.dialog.wide { max-width: 640px; }
.dialog > .window-body { overflow: auto; }
.dialog-buttons { display: flex; gap: 6px; justify-content: flex-end; padding: 0 10px 10px; flex-wrap: wrap; }
.dialog-buttons button { min-width: 84px; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg .big { font-size: 34px; line-height: 1; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

.pr-pop { text-align: center; }
.pr-trophy { font-size: 64px; animation: bounce .6s steps(4) infinite alternate; }
@keyframes bounce { to { transform: translateY(-8px) rotate(-6deg); } }
.pr-pop ul { list-style: none; padding: 0; margin: 10px 0; text-align: left; background: #fff; box-shadow: var(--in); }
.pr-pop li { padding: 6px 8px; border-bottom: 1px dotted var(--light); display: flex; justify-content: space-between; gap: 8px; }
.marquee { background: #000; color: var(--gold); font-family: var(--mono); overflow: hidden; white-space: nowrap; padding: 4px 0; }
.marquee span { display: inline-block; padding-left: 100%; animation: marquee 7s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

.pick-list { max-height: 50dvh; overflow: auto; }
.pick-list .ex-item { grid-template-columns: 34px 1fr; padding: 4px 6px; cursor: pointer; }

/* toasts (balloon tips) */
#toasts { position: fixed; right: 8px; bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom) + 8px); z-index: 90; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--tip); border: 1px solid #000; padding: 8px 12px; box-shadow: 2px 2px 0 rgba(0, 0, 0, .4); max-width: 280px; animation: pop .15s steps(3); }

/* confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
#confetti i { position: absolute; top: -12px; width: 8px; height: 8px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* boot & shutdown */
.boot { position: fixed; inset: 0; z-index: 500; background: linear-gradient(180deg, #2a6fd6 0%, #8cc4f2 60%, #fff 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; transition: opacity .3s; cursor: pointer; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-logo { display: flex; gap: 16px; align-items: center; }
.boot-title { font-size: 34px; font-weight: bold; color: #fff; text-shadow: 2px 2px #000; font-style: italic; }
.boot-title sup { color: var(--gold); font-size: 22px; }
.boot-sub { color: #fff; text-shadow: 1px 1px #000; }
.boot-bar { width: 220px; height: 14px; background: #000; overflow: hidden; border: 1px solid #fff; }
.boot-bar i { display: block; width: 60px; height: 100%; background: repeating-linear-gradient(90deg, #1a6be0 0 10px, #8cc4f2 10px 20px); animation: slide 1s linear infinite; }
@keyframes slide { from { transform: translateX(-60px); } to { transform: translateX(220px); } }
.boot-msg { color: #003; font-size: 12px; }
.shutdown { position: fixed; inset: 0; background: #000; color: #ff8c00; z-index: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 24px; text-align: center; padding: 20px; cursor: pointer; }
.shutdown small { color: #888; font-size: 13px; margin-top: 10px; }

/* ---- phone ---- */
@media (max-width: 700px) {
  :root { --taskbar-h: 50px; }
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; min-height: 36px; }
  button, .btn { min-height: 36px; }
  .desktop { padding: 0; }
  .main-window { max-width: none; }
  .hide-mobile { display: none !important; }
  .task { flex: 1; justify-content: center; font-size: 20px; padding: 0; }
  .task span { display: none; }
  .start-btn b { display: none; }
  .start-btn { padding: 2px 10px; }
  .tray #clock { display: none; }
  .tray { padding: 0 6px; }
  .tray:has(#trayTimer:empty) { display: none; }
  .cols { grid-template-columns: 1fr; }
  .log-form { grid-template-columns: 1fr 1fr; }
  .log-form .date-l { grid-column: 1 / -1; }
  .stat .v { font-size: 20px; }
  .start-menu { width: min(280px, 92vw); }
  .start-item { padding: 10px 8px; }
  .lcd { font-size: 40px; }
  .title-bar-controls button { width: 26px; height: 22px; }
}
@media (min-width: 701px) {
  .ex-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
