/* Mini Golf's course editor (editor.html): the pieces on the left, the hole in the middle, the course on the right.
   It builds on golf.css (the colours, the buttons, the dialogs). Desktop first; on a phone the three stack. */
.ed-body { height: auto; min-height: 100%; overflow: auto; background: #0c1520; }
.ed-top { position: sticky; background: rgba(8, 16, 26, .96); border-bottom: 1px solid var(--line); }
.ed-top .crumb a { color: var(--muted); text-decoration: none; }
.ed-top .crumb a:hover { color: var(--sunny); }
.ed-top .crumb .sep { margin: 0 8px; }
.lang-btn { font: 800 12px var(--display); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.ed { display: grid; grid-template-columns: 250px minmax(0, 1fr) 290px; gap: 12px; padding: 12px; height: calc(100vh - 52px); }
.ed > * { min-height: 0; }

/* the pieces */
.ed-palette { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 10px; overflow-y: auto; }
.ed-palette h2, .ed-side h2 { margin: 2px 4px 8px; font: 800 16px var(--display); }
.pal h3 { margin: 12px 4px 6px; font: 800 11px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pal-piece { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 5px; border-radius: 12px; border: 2px solid transparent; background: rgba(255, 255, 255, .04); font-size: 10.5px; font-weight: 700; line-height: 1.15; text-align: center; color: var(--muted); }
.pal-piece img { width: 64px; height: 64px; max-width: 100%; object-fit: contain; image-rendering: auto; }
.pal-piece:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.pal-piece.on { border-color: var(--sunny); background: rgba(255, 209, 102, .12); color: var(--text); }

/* the hole */
.ed-stage-wrap { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ed-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.ed-tools .seg.tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.ed-tools .seg.tools span { flex-direction: row; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 12px; }
.ed-tools .seg.tools b { font: 800 13px var(--display); }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .05); font-weight: 700; font-size: 13px; text-decoration: none; color: var(--text); white-space: nowrap; }
.tool-btn:hover { border-color: var(--sunny); color: var(--sunny); }
.tool-btn:disabled { opacity: .4; cursor: default; }
.tool-btn.small { width: 32px; height: 32px; padding: 0; justify-content: center; }
.tool-btn.go { background: linear-gradient(180deg, #7ff0b8, var(--mint-2)); color: #06281a; border-color: transparent; }
.tool-btn.go:hover { color: #06281a; filter: brightness(1.06); }
.tool-btn.danger { color: #ffb3bd; }
.height { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px; }
.height .lbl { color: var(--muted); font-size: 12px; font-weight: 700; margin-right: 2px; }
.height b { min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
.auto { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.auto input { accent-color: var(--mint); }
.ed-view { position: relative; flex: 1; min-height: 320px; display: flex; gap: 8px; }
.ed-stage { position: relative; flex: 1; min-width: 0; min-height: 0; border-radius: 18px; overflow: hidden; background: #9fd3ef; border: 1px solid var(--line); touch-action: none; user-select: none; -webkit-user-select: none; }
.ed-stage .golf-canvas { display: block; width: 100%; height: 100%; }
.ed-stage .tags, .ed-stage .shouts { position: absolute; }
.ed-stage .meter-host { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; z-index: 3; }
.ed-stage .shouts .shout b { font-size: clamp(28px, 5vw, 64px); }
body[data-mode="build"] .ed-stage { cursor: crosshair; }
body[data-mode="build"] .ed-stage[data-space] { cursor: grab; }
body[data-mode="build"] .ed-stage[data-drag] { cursor: grabbing; }

/* the view's buttons: a column beside the hole (over its corner where the screen is small), the line about the
   view's gestures, the height of what is being placed */
.ed-cam { flex: none; align-self: flex-start; display: grid; grid-template-columns: 34px; gap: 5px; padding: 6px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); transition: opacity .2s; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ed-cam .icon-btn { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; background: rgba(255, 255, 255, .07); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); backdrop-filter: none; -webkit-backdrop-filter: none; touch-action: none; }
.ed-cam .icon-btn[aria-pressed="true"] { background: rgba(255, 209, 102, .16); }
.ed-cam .ic { width: 20px; height: 20px; stroke-width: 1.9; }
.ed-cam .gap { grid-column: 1 / -1; height: 1px; margin: 1px 3px; background: var(--line-2); }
@media (max-width: 640px), (max-height: 560px) and (orientation: landscape) {
  .ed-view { gap: 0; }
  .ed-cam { position: absolute; right: 8px; bottom: 8px; z-index: 4; grid-template-columns: repeat(2, 34px); background: rgba(8, 16, 26, .5); border-color: var(--glass-line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 8px 24px rgba(0, 0, 0, .28); }
  body[data-busy] .ed-cam { opacity: .3; pointer-events: none; }        /* (painting or moving the view near it: see what is under it) */
}
.ed-cam-hint { position: absolute; left: 10px; top: 10px; z-index: 4; max-width: calc(100% - 20px); margin: 0; padding: 6px 12px; border-radius: 14px; background: rgba(8, 16, 26, .72); border: 1px solid var(--glass-line); color: var(--text); font-size: 12.5px; font-weight: 600; line-height: 1.35; pointer-events: none; transition: opacity .6s var(--ease), transform .6s var(--ease); }
.ed-cam-hint.gone { opacity: 0; transform: translateY(-6px); }
.ed-htag { position: absolute; left: 0; top: 0; z-index: 2; margin-top: -6px; padding: 2px 8px; border-radius: 999px; background: rgba(8, 16, 26, .82); border: 1px solid rgba(255, 209, 102, .5); color: var(--sunny); font: 800 11.5px var(--display); white-space: nowrap; pointer-events: none; }
body[data-mode="test"] .ed-cam-hint, body[data-mode="test"] .ed-htag { display: none; }
body[data-mode="test"] .ed-cam { opacity: .35; pointer-events: none; }
body[data-mode="test"] .ed-tools .seg.tools, body[data-mode="test"] .ed-tools .tool-row > :not(#testBtn) { opacity: .35; pointer-events: none; }
body[data-mode="test"] .ed-palette, body[data-mode="test"] .ed-side { opacity: .5; pointer-events: none; }
.ed-test-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.ed-test-bar b { margin-right: auto; padding-left: 6px; font: 800 15px var(--display); }
.ed-hint { margin: 0; min-height: 1.5em; color: var(--muted); font-size: 13px; text-align: center; }

/* the course */
.ed-side { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.ed-box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.field input { height: 38px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .25); color: var(--text); font-weight: 700; font-size: 15px; }
.field input:focus { outline: none; border-color: var(--sunny); }
.field.par { flex-direction: row; align-items: center; gap: 8px; }
.field.par span { margin-right: auto; }
.field.par b { min-width: 24px; text-align: center; font: 800 18px var(--display); color: var(--text); }
.moods { margin: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ed-holes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.ed-hole button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px; border-radius: 12px; border: 2px solid transparent; background: rgba(255, 255, 255, .03); text-align: left; }
.ed-hole button:hover { background: rgba(255, 255, 255, .07); }
.ed-hole.on button { border-color: var(--mint); background: rgba(95, 224, 160, .08); }
.ed-hole canvas { width: 72px; height: 54px; flex: none; border-radius: 8px; background: rgba(0, 0, 0, .25); }
.ed-hole .words { display: flex; flex-direction: column; min-width: 0; }
.ed-hole .words b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-hole .words small { color: var(--muted); font-size: 11.5px; }
.ed-hole-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.ed-checks { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.ed-checks li { padding: 6px 10px; border-radius: 10px; }
.ed-checks li.ok { background: rgba(95, 224, 160, .1); color: #bff5d9; }
.ed-checks li.bad { background: rgba(255, 90, 110, .12); color: #ffd3d9; }
.ed-box .play { margin-top: 0; height: 50px; }
.ed-box .play:disabled { filter: grayscale(.7); opacity: .6; cursor: default; }
.ed-share { margin-top: 10px; }
.ed-share p { margin: 4px 0; }
.ed-share input { width: 100%; height: 38px; padding: 0 10px; border-radius: 11px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .3); color: var(--text); font: 12px ui-monospace, Consolas, monospace; }
.ed-share .row { display: flex; gap: 6px; margin-top: 6px; }
.ed-foot { display: flex; justify-content: space-between; margin-top: 10px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }

/* a tablet held sideways, a small laptop: narrower sides, a wider hole */
@media (max-width: 1240px) and (min-width: 1001px) {
  .ed { grid-template-columns: 196px minmax(0, 1fr) 250px; gap: 10px; padding: 10px; }
  .pal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-tools .seg.tools span { padding: 7px 9px; }
}
@media (max-width: 1000px) {
  .ed { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ed-stage-wrap { order: 1; }
  .ed-view { min-height: 300px; flex: none; height: 56vh; }
  .ed-palette { order: 2; max-height: none; }
  .pal-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
  .ed-side { order: 3; overflow: visible; }
  .tool-row { margin-left: 0; }
  .ed-top .crumb a, .ed-top .crumb .sep:first-child { display: none; }
}
/* a phone held sideways: the pieces in a narrow column, the hole as tall as the screen, the tools as icons; the
   course below (scroll down) */
@media (max-height: 560px) and (orientation: landscape) {
  .ed-top { height: 44px; }
  .ed { grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: calc(100vh - 56px) auto; grid-template-rows: calc(100dvh - 56px) auto; gap: 6px; padding: 6px; padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); height: auto; }
  .ed-palette { order: 0; padding: 6px; border-radius: 14px; }
  .ed-palette h2 { display: none; }
  .pal h3 { margin: 6px 2px 4px; font-size: 9.5px; }
  .pal h3:first-child { margin-top: 0; }
  .pal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .pal-piece { padding: 2px 1px 3px; border-radius: 10px; font-size: 9px; }
  .pal-piece img { width: 44px; height: 44px; }
  .ed-stage-wrap { order: 0; gap: 6px; min-height: 0; }
  .ed-tools { flex-wrap: nowrap; gap: 4px; padding: 4px; border-radius: 13px; overflow-x: auto; scrollbar-width: none; }
  .ed-tools .seg.tools { flex-wrap: nowrap; gap: 3px; }
  .ed-tools .seg.tools span { padding: 6px 8px; border-radius: 10px; }
  .ed-tools .seg.tools b, .tool-row #rotBtn span, .tool-row #testBtn span, .height .lbl { display: none; }
  .tool-row { flex-wrap: nowrap; gap: 3px; margin-left: auto; }
  .tool-btn { height: 32px; padding: 0 9px; }
  .tool-btn.small { width: 28px; height: 28px; }
  .height b { min-width: 28px; }
  .ed-view { flex: 1; height: auto; min-height: 0; }
  .ed-cam { right: 6px; bottom: 6px; padding: 4px; gap: 4px; grid-template-columns: repeat(2, 30px); border-radius: 13px; }
  .ed-cam .icon-btn { width: 30px; height: 30px; border-radius: 9px; }
  .ed-cam .gap { display: none; }
  .ed-cam-hint { left: 6px; top: 6px; font-size: 11.5px; padding: 4px 10px; max-width: calc(100% - 100px); }
  .ed-hint { display: none; }
  .ed-test-bar { padding: 4px 6px; }
  .ed-side { order: 3; grid-column: 1 / -1; overflow: visible; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
}
