/* ==========================================================
   EASY GLOBAL TUNING
   ========================================================== */

:root {
  --page-bg: #e4e5e7;
  --panel-bg: #ffffff;
  --ink: #111318;
  --muted: #67707c;
  --line: #d8dce2;
  --accent: #1f4c73;

  --sheet-width: 1200px;
  --sheet-ratio: 1.4142857;

  --font-scale: 1;
  --cell-opacity: 0.72;
  --background-darkness: 0.22;
  --corner-radius: 28px;
  --grid-line-width: 4px;
}


/* ==========================================================
   APP
   ========================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--page-bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  user-select: none;
}

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 60px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  margin-bottom: 22px;
}

.app-header h1 {
  margin: 0;
  font-size: 26px;
}

.app-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.button {
  border: 1px solid #c8ced7;
  border-radius: 8px;
  padding: 9px 13px;
  background: #fff;
  color: #1c2733;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 80ms ease;
}

.button:hover {
  background: #f5f7f9;
  border-color: #aeb7c2;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.button.primary:hover {
  background: #183e5f;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

.editor-panel {
  display: grid;
  gap: 16px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(30, 40, 55, 0.05);
}

.panel h2 {
  margin: 0 0 15px;
  font-size: 17px;
}

.field,
.range-field {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
}

.field:last-child,
.range-field:last-child {
  margin-bottom: 0;
}

.field > span,
.range-field > span {
  font-size: 13px;
  font-weight: 650;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  border: 1px solid #cdd3dc;
  border-radius: 7px;
  background: #fff;
  color: #111318;
  padding: 9px 10px;
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.4;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(31, 76, 115, 0.22);
  border-color: var(--accent);
}

input[type="range"] {
  width: 100%;
}

.range-field output {
  color: var(--muted);
  font-weight: 500;
  margin-left: 5px;
}

.image-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: -5px 0 0;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.section-heading h2 {
  margin-bottom: 4px;
}

.requirements-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.requirement-row {
  display: grid;
  grid-template-columns: 48px 110px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  background: #fafbfc;
}

.requirement-index {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.requirement-row input {
  min-width: 0;
}


/* ==========================================================
   PREVIEW AREA
   ========================================================== */

.preview-section {
  margin-top: 22px;
}

.preview-toolbar {
  margin-bottom: 10px;
}

.preview-toolbar strong {
  margin-right: 8px;
}

.preview-stage {
  overflow: auto;
  padding: 18px;
  border: 1px solid #cfd3d8;
  border-radius: 12px;
  background:
    linear-gradient(45deg, #d9dbde 25%, transparent 25%),
    linear-gradient(-45deg, #d9dbde 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d9dbde 75%),
    linear-gradient(-45deg, transparent 75%, #d9dbde 75%);
  background-size: 24px 24px;
  background-position:
    0 0,
    0 12px,
    12px -12px,
    -12px 0;
}


/* ==========================================================
   RESEARCH SHEET
   ========================================================== */

.research-sheet {
  width: var(--sheet-width);
  aspect-ratio: var(--sheet-ratio);
  margin: 0 auto;
  overflow: hidden;
  background: white;
  color: #050505;
  box-shadow: 0 7px 26px rgba(0, 0, 0, 0.22);
  transform-origin: top left;
}

.sheet-header {
  height: 84px;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 10px 24px 8px;
  background: white;
}

.sheet-brand {
  min-width: 0;
  display: flex;
  align-items: center;
}

.text-masthead {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  white-space: nowrap;
}

.text-masthead .watch {
  display: inline-flex;
  align-items: center;
  font-size: calc(25px * var(--font-scale));
  line-height: 0.9;
  font-weight: 950;
  letter-spacing: -1.5px;
}

.text-masthead .research {
  font-size: calc(38px * var(--font-scale));
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0.5px;
}

.project-heading {
  min-width: 0;
  font-size: calc(25px * var(--font-scale));
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.research-board {
  position: relative;
  height: calc(100% - 84px);
  overflow: hidden;
  background:
    linear-gradient(
      rgba(0, 0, 0, var(--background-darkness)),
      rgba(0, 0, 0, var(--background-darkness))
    ),
    var(--research-background, linear-gradient(135deg, #455260, #82909b));
  background-size: cover;
  background-position: center;
}

.research-grid {
  position: absolute;
  inset: 0;

  display: grid;
  grid-template-columns: repeat(var(--columns, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 3), minmax(0, 1fr));

  background: transparent;
}

.grid-cell {
  position: relative;
  min-width: 0;
  min-height: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 22px;
  overflow: hidden;
  background: transparent;

  /* Grid lines render over the continuous background image. */
  box-shadow:
    inset 0 0 0 calc(var(--grid-line-width) / 2) #050505;
}

.cell-card {
  width: 100%;
  height: 78%;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  padding: 18px 22px;

  border-radius: var(--corner-radius);

  background: rgba(
    224,
    225,
    226,
    var(--cell-opacity)
  );

  color: #080808;
  text-align: center;
}

.item-card {
  font-size: calc(23px * var(--font-scale));
  line-height: 1.06;
  font-weight: 450;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.cost-card {
  gap: 12px;
}

.cost-label {
  font-size: calc(20px * var(--font-scale));
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
}

.cost-value {
  font-size: calc(63px * var(--font-scale));
  line-height: 0.95;
  font-weight: 850;
  letter-spacing: 1px;
}

.empty-cell .cell-card {
  visibility: hidden;
}

.reward-card {
  height: 78%;
  justify-content: flex-start;
  padding-top: 17px;
  background: rgba(255, 253, 190, 0.96);
}

.reward-title {
  margin-bottom: 17px;
  font-size: calc(17px * var(--font-scale));
  line-height: 1;
  text-transform: uppercase;
}

.reward-text {
  margin: auto 0;
  font-size: calc(16px * var(--font-scale));
  line-height: 1.18;
  white-space: pre-line;
  overflow-wrap: anywhere;
}




/* ==========================================================
   RESPONSIVE APP UI
   ========================================================== */

@media (max-width: 1050px) {
  .editor-grid {
    grid-template-columns: 1fr 1fr;
  }

  .editor-grid .panel:last-child {
    grid-column: 1 / -1;
  }

  .requirements-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1500px);
    padding-top: 14px;
  }

  .app-header {
    flex-direction: column;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-grid .panel:last-child {
    grid-column: auto;
  }

  .requirements-editor {
    grid-template-columns: 1fr;
  }

  .requirement-row {
    grid-template-columns: 42px 96px minmax(0, 1fr);
  }
}
