/* MagicBucket.pro — app. Same look as the site (style.css), calmer: no tilts, no halftone animation.
   Only own files: no fonts, scripts or styles from third-party servers. */

@font-face {
  font-family: "Bangers";
  src: url(fonts/bangers-latin.woff2) format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #16171f;
  --paper: #fffdf6;
  --cream: #f3f1e5;
  --yellow: #ffe14d;
  --red: #e8322b;
  --blue: #1d5fc9;
  --green: #1f7a3d;
  --amber: #a85d00;
  --muted: #4c4f5e;
  --line: #d9d4c3;
  --comic: "Bangers", "Impact", "Arial Black", sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.55 var(--text);
  color: var(--ink);
  background-color: var(--cream);
  background-image: radial-gradient(circle, rgba(232, 50, 43, .08) 26%, transparent 28%);
  background-size: 16px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: .18em; }
:focus-visible { outline: 4px solid var(--yellow); outline-offset: 2px; box-shadow: 0 0 0 7px var(--ink); }
[hidden] { display: none !important; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  padding: 8px 14px; background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); font-weight: 700;
}
.skip:focus { top: 12px; }

/* ------------------------------------------------------------ top bar */

.bar { background: var(--paper); border-bottom: 4px solid var(--ink); }
.bar-in {
  max-width: 1180px; margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; gap: 10px 20px; flex-wrap: wrap;
}
.brand { display: block; line-height: 0; }
.brand img { display: block; width: auto; height: 42px; }
@media (max-width: 420px) { .brand img { height: 34px; } }

.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  padding: 5px 12px 3px; border: 3px solid transparent; border-radius: 8px;
  font: 1.15rem/1.1 var(--comic); letter-spacing: .04em; color: var(--ink); text-decoration: none;
}
.nav a:hover { border-color: var(--ink); }
.nav a[aria-current="page"] { background: var(--yellow); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }

.who { margin-left: auto; display: flex; gap: 10px; align-items: center; min-width: 0; }
.who-mail { color: var(--muted); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-block; padding: 8px 16px 6px;
  font: 1.15rem/1.1 var(--comic); letter-spacing: .04em; color: var(--ink);
  background: var(--yellow); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none; cursor: pointer; transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 4px 4px 0 var(--ink); }
.btn-hot { background: var(--red); color: #fff; }
.btn-plain { background: #fff; }
.btn-small { font-size: .98rem; padding: 5px 11px 3px; box-shadow: 3px 3px 0 var(--ink); }
.btn-big { font-size: 1.5rem; padding: 11px 24px 8px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
.link-btn.danger { color: #b3261e; }

/* ------------------------------------------------------------ layout */

main { flex: 1; padding: 26px 0 40px; }
main:focus { outline: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.loading { color: var(--muted); }

h1, h2, h3 { font-family: var(--comic); font-weight: 400; letter-spacing: .04em; line-height: 1.1; }
h1 { font-size: 2.2rem; margin: 0 0 16px; }
h2 { font-size: 1.6rem; margin: 0 0 12px; }
h3 { font-size: 1.25rem; margin: 18px 0 8px; }

.panel {
  background: var(--paper); border: 4px solid var(--ink); border-radius: 6px; box-shadow: 6px 6px 0 var(--ink);
  padding: 18px 20px; margin: 0 0 26px; min-width: 0;
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }
@media (max-width: 560px) { .panel { padding: 14px 14px; box-shadow: 4px 4px 0 var(--ink); } }

.head-row { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 12px; }
.head-row > h1, .head-row > h2 { margin: 0; }
.head-row .push { margin-left: auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 26px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.muted { color: var(--muted); }
.small { font-size: .9rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; overflow-wrap: anywhere; }
.back { display: inline-block; margin: 0 0 12px; }

/* ------------------------------------------------------------ messages */

.msg { border: 3px solid var(--ink); border-radius: 6px; padding: 10px 14px; margin: 0 0 16px; background: #fff; }
.msg-error { background: #fde7e5; border-color: #b3261e; }
.msg-info { background: #e8f0fd; border-color: var(--blue); }
.msg-ok { background: #e5f4ea; border-color: var(--green); }
.msg p { margin: 0; }
.msg p + p { margin-top: 6px; }

/* ------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; margin: 0 0 6px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { border-bottom: 2px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { border-bottom: 3px solid var(--ink); font-weight: 700; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fff7cf; }
td.num, th.num { text-align: right; white-space: nowrap; }
td .quote { display: block; margin-top: 4px; color: var(--muted); font-size: .88rem; font-style: italic; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 10px 0; }

/* ------------------------------------------------------------ badges */

.badge {
  display: inline-block; padding: 1px 8px; border: 2px solid var(--ink); border-radius: 999px;
  font-size: .8rem; font-weight: 700; white-space: nowrap; background: #fff; line-height: 1.5;
}
.b-ok { background: #c9efd5; }
.b-warn { background: #ffe9b3; }
.b-bad { background: #ffd0cc; }
.b-run { background: #d6e4fb; }
.b-off { background: #ecebe4; color: var(--muted); border-color: var(--muted); }
.counts { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------ forms */

.field { margin: 0 0 12px; min-width: 0; }
.field label, .field legend { display: block; font-weight: 700; margin: 0 0 4px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .88rem; }
input[type=text], input[type=email], select, textarea {
  width: 100%; font: inherit; font-size: .98rem; padding: 7px 10px;
  border: 3px solid var(--ink); border-radius: 6px; background: #fff; color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
textarea.json { min-height: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--red); outline-offset: 1px; box-shadow: none; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--red); vertical-align: middle; }
.inline-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
@media (max-width: 640px) { .inline-form { grid-template-columns: minmax(0, 1fr); } }

/* template editor: compact inputs inside tables */
.editor td { padding: 6px 6px; }
.editor input[type=text], .editor select, .editor textarea { padding: 5px 7px; border-width: 2px; font-size: .9rem; }
.editor textarea { min-height: 54px; }
.editor .w-name { min-width: 130px; }
.editor .w-label { min-width: 150px; }
.editor .w-desc { min-width: 220px; }
.editor .w-unit { min-width: 70px; }
.editor tr.dropped td { opacity: .45; }

/* ------------------------------------------------------------ upload */

.drop {
  display: block; border: 3px dashed var(--ink); border-radius: 8px; background: #fff;
  padding: 26px 16px; text-align: center; cursor: pointer;
}
.drop.over { background: #fff7cf; border-style: solid; }
.drop strong { font: 1.5rem/1.1 var(--comic); letter-spacing: .04em; display: block; margin: 0 0 4px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.queue { list-style: none; margin: 12px 0 0; padding: 0; }
.queue li { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 2px solid var(--line); }
.queue .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .queue li { grid-template-columns: minmax(0, 1fr) auto; } .queue progress { display: none; } }
progress { width: 100%; height: 12px; accent-color: var(--red); }

.meter { height: 16px; border: 3px solid var(--ink); border-radius: 6px; background: #fff; overflow: hidden; margin: 6px 0; }
.meter > span { display: block; height: 100%; background: var(--yellow); }

/* ------------------------------------------------------------ detail */

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.section-text { white-space: pre-wrap; background: #fff; border: 2px solid var(--line); border-radius: 6px; padding: 10px 12px; }
details { margin: 8px 0; }
summary { cursor: pointer; font-weight: 700; }

/* ------------------------------------------------------------ login */

.login-box { max-width: 560px; margin: 30px auto; text-align: center; }
.login-box p { margin: 0 0 18px; }

/* ------------------------------------------------------------ footer */

.foot { background: var(--ink); color: #d8d5ca; font-size: .88rem; }
.foot-in { display: flex; gap: 8px 22px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 18px; }
.foot a { color: #fff; }

.mt { margin-top: 8px; }
.drop:focus-within { outline: 4px solid var(--yellow); outline-offset: 2px; box-shadow: 0 0 0 7px var(--ink); }
.badge { font-family: var(--text); letter-spacing: normal; }
.title-file { font: 700 1.6rem/1.25 var(--text); letter-spacing: 0; overflow-wrap: anywhere; }
.editor select { min-width: 112px; }
