﻿:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --ink: #18202a;
  --muted: #657386;
  --line: #dce4ee;
  --accent: #83b735;
  --accent-dark: #659b21;
  --blue: #83b735;
  --rose: #be3455;
  --warning-line: #f0c36d;
  --warning-bg: #fff7df;
  --warning-ink: #76520b;
  --shadow: 0 16px 42px rgba(24, 32, 42, 0.12);
  --shadow-soft: 0 10px 28px rgba(24, 32, 42, 0.09);
  --shadow-lift: 0 18px 36px rgba(24, 32, 42, 0.14);
  --font-main: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
  font-size: 13px;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: 100%;
  height: 100vh;
  min-height: 520px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
}

.top-bar,
.content-frame,
.bottom-bar,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.top-bar {
  min-height: 58px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  object-fit: contain;
}

.app-icon-rotating {
  animation: mili-icon-spin 1.1s linear infinite;
}

@keyframes mili-icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.brand-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  padding: 0 12px 2px;
  color: #18202a;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: clamp(18px, 1.75vw, 30px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

.brand-heading-mili,
.brand-heading-studio {
  display: inline-block;
  font-family: "Cooper Black", "Arial Rounded MT Bold", "Segoe UI Black", Arial, Helvetica, sans-serif;
  font-size: 1.28em;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.9),
    0 4px 8px rgba(24, 32, 42, 0.16);
}

.brand-heading-mili {
  color: #ff8a00;
  transform: rotate(-1deg);
}

.brand-heading-studio {
  color: #0f1216;
  margin-left: 4px;
  transform: rotate(0.5deg);
}

.brand-heading-divider {
  color: var(--accent);
  font-weight: 900;
  font-size: 1.12em;
}

.brand-heading-tagline {
  color: #172230;
  font-family: "Segoe UI Semibold", "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.82em;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 2px 4px rgba(24, 32, 42, 0.08);
}

.model-search {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 8px 12px;
  outline: 0;
  font-size: 14px;
  font-weight: 700;
}

.model-search::placeholder {
  color: var(--muted);
  font-weight: 600;
}

.model-search:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(131, 183, 53, 0.18);
}

.results-search {
  flex: 1 1 420px;
  min-width: 220px;
  height: 34px;
}

.model-category-select {
  flex: 0 0 136px;
  min-width: 136px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 6px 28px 6px 10px;
  outline: 0;
  font-size: 13px;
  font-weight: 700;
}

.model-category-select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(131, 183, 53, 0.18);
}

.content-frame {
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.workspace {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(240px, 28%) minmax(0, 1fr);
  gap: 12px;
}

.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: none;
}

.panel-header {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-title {
  flex: 1;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.results-panel .panel-title {
  flex: 0 0 230px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 800;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button:active,
button.is-active {
  background: var(--blue);
  transform: translateY(0);
}

button:disabled {
  background: #c9d3df;
  color: var(--muted);
  cursor: default;
  transform: none;
}

.tool-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  line-height: 1;
}

.tool-button:hover {
  background: #e7edf4;
  color: var(--ink);
}

.tool-button.is-active {
  border-color: var(--blue);
  background: #f0f8e7;
  color: var(--blue);
}

.tool-button svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
}

.drop-area {
  flex: 1;
  min-height: 0;
  border: 2px dashed #aebdd0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  position: relative;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-area.is-over,
.drop-area:hover {
  border-color: var(--accent);
  background: #f3faea;
  transform: translateY(-1px);
}

.drop-upload-icon {
  width: 126px;
  height: 96px;
  margin-top: 18px;
  stroke: #c9d1dc;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0.95;
  pointer-events: none;
}

.drop-area img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 6px;
  background: var(--surface-soft);
}

.results {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.results.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-content: start;
  gap: 10px;
}

.results.large {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-content: start;
  gap: 12px;
}

.results.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-item {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.result-item:hover,
.result-item:focus {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  outline: 0;
}

.result-item.selected {
  border-color: var(--blue);
  background: #f0f8e7;
}

.grid .result-item {
  min-height: 172px;
  grid-template-rows: 108px auto;
}

.large .result-item {
  min-height: 310px;
  grid-template-rows: 230px auto;
}

.list .result-item {
  min-height: 86px;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
}

.thumb {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 6px;
  background: var(--surface-soft);
}

.result-name {
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
  text-align: center;
}

.list .result-name {
  text-align: left;
}

.score {
  display: inline-block;
  margin-bottom: 3px;
  color: var(--accent);
  font-weight: 800;
}

.model-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  word-break: break-word;
}

.details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px 10px 10px;
  position: relative;
  display: grid;
  gap: 6px;
}

.details::before {
  content: "Details";
  position: absolute;
  left: 10px;
  top: -8px;
  padding: 0 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.query-label,
.folder-label {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.query-label {
  min-height: 44px;
  max-height: 58px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 6px;
  color: var(--ink);
}

.progress {
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
  display: none;
  position: relative;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

.progress span {
  position: absolute;
  inset: 0 8px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: right;
}

.bottom-bar {
  min-height: 34px;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto;
    padding: 10px;
  }

  .top-bar {
    align-items: flex-start;
  }

  .brand-heading {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px 8px;
    padding-right: 0;
    font-size: 20px;
    white-space: normal;
    text-align: left;
  }

  .brand-heading-tagline {
    flex: 1 0 100%;
    font-size: 0.72em;
  }

  .content-frame,
  .workspace {
    display: flex;
    flex-direction: column;
  }

  .drop-area {
    min-height: 240px;
  }

  .results {
    min-height: 340px;
  }

  .results-panel .panel-header {
    flex-wrap: wrap;
  }

  .results-panel .panel-title {
    flex: 1 0 100%;
  }

  .results-search {
    flex-basis: 140px;
    min-width: 140px;
  }

  .model-category-select {
    flex: 1 1 140px;
  }
}
