@font-face {
  font-family: "RobotoA3";
  src: url("../assets/Roboto-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "RobotoA3Light";
  src: url("../assets/Roboto-Light.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --ink: #1e0e00;
  --red: #f35856;
  --bg: #eef0f2;
  --panel: #ffffff;
  --line: #e3e5e8;
  --muted: #7c8085;
  --radius: 12px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "RobotoA3", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* ---------------------------------------------------------------- панель */

.panel {
  width: 336px;
  flex: 0 0 336px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 20px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 40px; height: 46px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 500;
  letter-spacing: .5px;
  font-size: 15px;
}
h1 { font-size: 16px; margin: 0; font-weight: 500; }
.brand p { margin: 2px 0 0; font-size: 12px; }

h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 500;
}

.block { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.hint .link { font-size: 12px; }

/* ------------------------------------------------------------- загрузка */

.drop {
  border: 1px dashed #cfd3d8;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: .15s border-color, .15s background;
  background: #fafbfc;
}
.drop:hover, .drop.over { border-color: var(--red); background: #fff6f5; }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #9aa0a6; }
.drop-empty b { color: var(--ink); font-weight: 500; }
.drop-empty span { font-size: 12px; }

.drop-filled { display: flex; gap: 12px; text-align: left; align-items: center; }
.drop-filled img {
  width: 66px; height: 84px; object-fit: cover; border-radius: 6px; flex: 0 0 auto;
  background: #eee;
}
.drop-meta { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.file-name {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px;
}

/* ----------------------------------------------------------- управление */

.row { display: flex; gap: 8px; flex-wrap: wrap; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 7px 11px;
  transition: .15s background, .15s border-color, .15s color;
}
button:hover { background: #f5f6f7; }
button:active { transform: translateY(1px); }

.ghost { background: #f7f8f9; }
.ghost:hover { background: #eef0f2; }
.link {
  border: 0; background: none; padding: 0;
  color: var(--red); text-decoration: underline; text-underline-offset: 2px;
}
.link:hover { background: none; }

.btn { flex: 1; font-weight: 500; padding: 9px 10px; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #35200f; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.wide { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field > span { display: flex; justify-content: space-between; }
.field output { color: var(--ink); }

input[type="range"] { width: 100%; accent-color: var(--red); }

input[type="text"], select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  width: 100%;
}
input[type="text"]:focus, select:focus { outline: 2px solid #fdeceb; border-color: var(--red); }

.period { display: flex; gap: 8px; align-items: center; }
.period select { flex: 1; }
.period .nav {
  width: 34px; height: 36px; flex: 0 0 34px;
  font-size: 18px; line-height: 1; padding: 0;
  display: grid; place-items: center;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f2f4;
  border-radius: 10px;
}
.seg {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 4px;
  font-size: 12px;
  white-space: nowrap;
  border-radius: 7px;
  color: var(--muted);
}
.seg:hover { background: rgba(0, 0, 0, .04); }
.seg.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 20, 25, .12);
  font-weight: 500;
}

.check { display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--ink); }
.check input { accent-color: var(--red); width: 16px; height: 16px; }

.status { min-height: 16px; color: var(--red); }

/* --------------------------------------------------------------- сцена */

.stage {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  overflow: auto;
  background:
    radial-gradient(120% 90% at 50% 0%, #f7f8f9 0%, #e7e9ec 100%);
}

.paper-wrap {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#view {
  height: min(100%, calc(100vh - 52px));
  width: auto;
  max-width: 100%;
  background: #fff;
  box-shadow: 0 18px 50px rgba(20, 20, 25, .18), 0 2px 6px rgba(20, 20, 25, .08);
  border-radius: 2px;
  cursor: grab;
  touch-action: none;
}
#view.dragging { cursor: grabbing; }

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .72);
  color: var(--muted);
  border-radius: 2px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.loading.on { opacity: 1; }

/* подсказка поверх пустого макета */
.canvas-hint {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(20, 20, 25, .08);
}
.canvas-hint[hidden] { display: none !important; }

@media (max-width: 900px) {
  .app { flex-direction: column; overflow-y: auto; }
  .panel {
    width: 100%; flex: 0 0 auto; max-height: none;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .stage { min-height: 78vh; padding: 14px; overflow: visible; }
  #view { height: auto; width: 100%; max-height: none; }
  .canvas-hint { top: 6%; }
}
