/* ****** BBGD FIELD OPS APP v0.1.17 ** app/app.css ******
   Two looks (FO-D-107): cabin screens follow the phone's light/dark setting; entry screens
   (strata, hole, water, photos, finish, day-sheet readings) always use the SUN look:
   black on cream, heavy type, big targets. Readable at arm's length without glasses (FO-D-106). */

/* ****** BLOCK 1 ** COLOURS AND TYPE ****** */
:root {
  --bg: #f4f6f8; --card: #ffffff; --txt: #10202c; --mut: #4d5f6e; --line: #d5dde4;
  --acc: #0b3d5c; --acc2: #1f6f9c; --ok: #1d7a3e; --warn: #c7811a; --bad: #b3261e; --sel: #ffd166;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1a23; --card: #16242f; --txt: #eef3f7; --mut: #a9b8c4; --line: #2b3b48; --acc: #2b86c5; --acc2: #4aa3e0; }
}
body.sun {
  --bg: #fff8e7; --card: #fffdf6; --txt: #000000; --mut: #2a2a2a; --line: #c9b98a;
  --acc: #000000; --acc2: #1a1a1a; --ok: #0a5c2a; --warn: #9a5b00; --bad: #8f1d16; --sel: #ffcc00;
}
* { -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--txt); }
body { font: 22px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 600; padding-bottom: 24px; }
body.sun { font-weight: 800; }

/* ****** BLOCK 2 ** TOP BAR ****** */
#top { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 56px 1fr auto; align-items: center;
  gap: 8px; padding: 8px 12px; background: var(--acc); color: #fff; }
body.sun #top { background: #000; }
#title { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sync { font-size: 15px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.18); }
#sync.bad { background: var(--bad); }
#sync.ok { background: var(--ok); }
.back { min-height: 44px; min-width: 44px; font-size: 34px; line-height: 1; background: transparent; color: #fff; border: 0; padding: 0; }
.back[hidden] { visibility: hidden; display: block; }

/* ****** BLOCK 3 ** CARDS, ROWS, BUTTONS ****** */
#screen { padding: 12px; max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
h1 { font-size: 26px; margin: 4px 0 10px; }
h2 { font-size: 22px; margin: 0 0 10px; }
.sub { color: var(--mut); font-size: 17px; font-weight: 600; margin: -6px 0 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.row > * { flex: 1 1 140px; }
button { font: inherit; font-weight: 800; min-height: 64px; padding: 10px 14px; border: 0; border-radius: 14px;
  background: var(--acc); color: #fff; }
body.sun button { border: 3px solid #000; background: #000; color: #fff; }
button.sec { background: transparent; color: var(--txt); border: 3px solid var(--acc); }
body.sun button.sec { background: #fff; color: #000; }
button.ok { background: var(--ok); }
button.danger { background: var(--bad); }
button.big { min-height: 84px; font-size: 26px; }
button:disabled { opacity: .45; }
button.sel, .tile.sel, .chip.sel { background: var(--sel) !important; color: #000 !important; border-color: #000 !important; }

/* tiles (strata) and chips */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { min-height: 92px; font-size: 26px; }
.tile.wide { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 56px; padding: 6px 16px; border-radius: 999px; font-size: 20px; flex: 0 0 auto; }

/* readings: a label with a big value that opens the number pad */
.reading { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.reading:first-of-type { border-top: 0; }
.reading .lbl { font-size: 19px; }
.reading .hint { display: block; font-size: 15px; color: var(--mut); font-weight: 600; }
.reading button { min-width: 140px; min-height: 60px; font-size: 26px; }
.reading button.empty { background: transparent; color: var(--mut); border: 3px dashed var(--line); }
body.sun .reading button.empty { color: #000; border-color: #000; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 19px; }
.list li:first-child { border-top: 0; }
.list li .meta { display: block; font-size: 15px; color: var(--mut); }
.list li button { min-height: 48px; min-width: 48px; padding: 4px 12px; font-size: 18px; }
.badge { display: inline-block; font-size: 14px; padding: 2px 10px; border-radius: 999px; background: var(--warn); color: #000; vertical-align: middle; }
.badge.train { background: #ff5d5d; color: #000; }
.note { font-size: 16px; color: var(--mut); font-weight: 600; }
.warn { background: var(--warn); color: #000; padding: 10px 12px; border-radius: 12px; font-weight: 700; margin-bottom: 12px; font-size: 17px; }
.good { background: var(--ok); color: #fff; padding: 10px 12px; border-radius: 12px; font-weight: 700; margin-bottom: 12px; font-size: 17px; }
.tabs { display: grid; grid-auto-flow: column; gap: 6px; margin-bottom: 12px; }
.tabs button { min-height: 56px; font-size: 16px; padding: 6px 4px; }
.depth { font-size: 34px; text-align: center; margin: 6px 0 10px; }
.depth small { display: block; font-size: 16px; color: var(--mut); }

/* text inputs only on cabin screens (notes, names) */
input[type=text], textarea, select { font: inherit; width: 100%; box-sizing: border-box; min-height: 60px; padding: 10px 12px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--txt); }
textarea { min-height: 110px; font-weight: 600; }
label { display: block; font-size: 17px; color: var(--mut); margin: 10px 0 4px; }

/* photos */
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); }
.thumbs .cap { font-size: 13px; color: var(--mut); text-align: center; }

/* ****** BLOCK 4 ** NUMBER PAD ****** */
.pad { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; z-index: 20; }
.pad[hidden] { display: none; }   /* 'hidden' must beat display:flex, or an invisible overlay blocks every tap */
.padbox { width: 100%; max-width: 640px; margin: 0 auto; background: #fffdf6; color: #000; border-radius: 20px 20px 0 0; padding: 14px 14px 22px; }
.padtitle { font-size: 20px; font-weight: 800; }
.padshow { font-size: 44px; font-weight: 800; text-align: right; padding: 6px 10px; border: 3px solid #000; border-radius: 12px; margin: 8px 0; min-height: 60px; }
.padunit { font-size: 22px; margin-left: 8px; }
.padkeys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.padkeys button { min-height: 68px; font-size: 30px; background: #fff; color: #000; border: 3px solid #000; }
.padrow { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin-top: 8px; }
.padrow button { min-height: 64px; font-size: 22px; }
.padrow .ok { background: #0a5c2a; color: #fff; border: 3px solid #000; }
.padrow .sec { background: #fff; color: #000; border: 3px solid #000; }
/* v0.1.2: the layer being edited is highlighted in the log; the depth pacer is a button */
.list li.cur { background: var(--sel); margin: 0 -14px; padding: 10px 14px; border-radius: 10px; }
.depth button { font-size: 30px; min-height: 64px; width: 100%; }
/* v0.1.14: fitting picture tiles */
.ftiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ftile { position: relative; }
.ftile .fadd { width: 100%; min-height: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 6px;
  background: #fff; color: #000; border: 3px solid #000; border-radius: 14px; }
.ftile.sel .fadd { background: var(--sel); }
.ftile .fname { font-size: 16px; line-height: 1.15; text-align: center; }
.ftile .fsize { font-size: 22px; font-weight: 900; }
.ftile .fcount { position: absolute; top: 6px; right: 8px; min-width: 34px; height: 34px; line-height: 34px; border-radius: 17px; background: #000; color: #fff; font-size: 20px; text-align: center; }
.ftile .fminus { position: absolute; top: 6px; left: 6px; min-height: 40px; min-width: 40px; padding: 0; font-size: 26px; line-height: 1; border-radius: 20px; background: #fff; color: #000; border: 3px solid #000; }
/* v0.1.15: running-low flag corner on fitting tiles */
.ftile .fflag { position: absolute; bottom: 6px; right: 6px; min-height: 36px; min-width: 36px; padding: 0; font-size: 18px; line-height: 1; border-radius: 18px;
  background: #fff; color: #8f1d16; border: 2px solid #8f1d16; }
.ftile .fflag.on { background: #8f1d16; color: #fff; }
