* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: #fff;
  background: #3b3b3b;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.window {
  width: 100%;
  min-height: 100vh;
  background: #3b3b3b;
}

.content {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.header,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-text h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.1;
}

.subtitle {
  margin: 0;
  opacity: .7;
}

.header-icon {
  width: 56px;
  height: 56px;
  margin-right: 4px;
  object-fit: contain;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #262626;
}

.tabs a {
  padding: 9px 16px;
  border-radius: 5px 5px 0 0;
  color: #fff;
  text-decoration: none;
  opacity: .7;
}

.tabs a:hover,
.tabs a.active {
  color: #fff;
  background: #333;
  opacity: 1;
}

.hidden {
  display: none !important;
}

.tab-panel {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.main {
  display: flex;
  flex: 1;
  min-height: 300px;
  gap: 12px;
}

.drop-panel,
.sidebar,
.panel,
.android-content {
  border: 1px solid #262626;
  border-radius: 8px;
  background: #333;
}

.drop-panel {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  overflow: auto;
  padding: 12px;
}

.drop-panel.dragover {
  border-color: #0078d4;
  box-shadow: 0 0 0 1px rgb(0 120 212 / 30%);
}

.drop-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 0 12px;
}

.drop-title {
  font-size: 18px;
  text-align: center;
}

.drop-or,
.item-dimensions {
  opacity: .7;
}

.sidebar {
  width: 190px;
  flex: 0 0 190px;
  padding: 10px;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
}

.checkbox input {
  accent-color: #0078d4;
}

.export-sizes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.export-sizes[hidden] {
  display: none;
}

.button {
  padding: 8px 14px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 4px;
  color: #fff;
  background: #2d2d2d;
  font: inherit;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: rgb(255 255 255 / 12%);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.button.accent {
  border: 0;
  background: #0078d4;
}

.button.accent:hover:not(:disabled) {
  background: #106ebe;
}

.item-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.item-card {
  display: flex;
  width: 270px;
  min-height: 110px;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 6px;
}

.preview-box {
  display: flex;
  width: 64px;
  height: 82px;
  flex: 0 0 64px;
  align-items: center;
  justify-content: center;
  background: rgb(255 255 255 / 6%);
}

.preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.item-details {
  min-width: 0;
  flex: 1;
}

.item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-warning,
.item-note {
  color: #ffa500;
  font-size: 11px;
  line-height: 1.2;
}

.item-note {
  color: #8ed0ff;
}

.remove-button {
  flex: 0 0 auto;
  padding: 6px 9px;
}

.footer {
  flex-wrap: wrap;
}

.status {
  min-width: 180px;
  flex: 1;
}

.footer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.textbox {
  width: 150px;
  padding: 6px 8px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 4px;
  color: #fff;
  background: #2d2d2d;
  font: inherit;
}

.textbox:focus,
.button:focus-visible,
.tabs a:focus-visible {
  outline: 2px solid #0078d4;
  outline-offset: 1px;
}

.android-input {
  padding: 12px;
}

.android-main {
  display: flex;
  min-height: 0;
  flex: 1;
  gap: 12px;
}

.android-left {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 12px;
}

.android-sidebar {
  width: 190px;
  min-height: 0;
  overflow: auto;
}

.android-sidebar .toolbar,
.android-sidebar .controls {
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
}

.android-sidebar .toolbar select,
.android-sidebar .toolbar .button {
  width: 100%;
  min-width: 0;
}

.android-sidebar .toolbar .button {
  padding-right: 6px;
  padding-left: 6px;
  font-size: 12px;
  white-space: normal;
}

.android-sidebar .controls label {
  justify-content: space-between;
}

.android-sidebar .controls .textbox {
  min-width: 0;
  max-width: 100%;
}

.android-drop {
  min-height: 120px;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.android-drop input[type="file"] {
  display: none;
}

.paste-label {
  display: block;
  margin-top: 12px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 100px;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 5px;
  color: #fff;
  background: #2d2d2d;
  font: 12px/1.4 ui-monospace, monospace;
}

.paste-label + .button {
  margin-top: 9px;
}

.android-content {
  min-height: 0;
  flex: 1;
  padding: 12px;
}

.toolbar,
.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar select {
  min-width: 180px;
  flex: 1;
}

.warnings {
  margin: 8px 0;
  padding: 9px;
  border: 1px solid #8c6e20;
  border-radius: 6px;
  color: #ffd977;
  background: #493d1d;
}

.warnings:empty {
  display: none;
}

.editor {
  padding: 12px;
}

.editor label {
  font-weight: 600;
}

.editor textarea {
  min-height: 220px;
}

.controls label {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.controls .textbox {
  width: auto;
}

.previews {
  display: grid;
  min-height: 0;
  grid-template-columns: 320px 320px;
  gap: 12px;
  flex: 1;
}

.previews article {
  min-width: 0;
  min-height: 0;
}

.previews h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.canvas {
  display: flex;
  width: 100%;
  height: 320px;
  min-height: 320px;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border: 1px solid #262626;
  border-radius: 6px;
  padding: 0;
}

.canvas svg {
  display: block;
  width: var(--size, 240px) !important;
  height: var(--size, 240px) !important;
  max-width: 92%;
  max-height: 280px;
}

.checker {
  background-color: #444;
  background-image:
    linear-gradient(45deg, #666 25%, transparent 25%),
    linear-gradient(-45deg, #666 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #666 75%),
    linear-gradient(-45deg, transparent 75%, #666 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.light {
  background: #f2f2f2;
}

.dark {
  background: #1f1f1f;
}

@media (max-width: 700px) {
  .main {
    flex-direction: column;
  }

  .sidebar {
    width: auto;
    flex-basis: auto;
  }

  .item-card {
    width: 100%;
  }

  .footer-actions {
    flex-wrap: wrap;
  }

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

  .android-main {
    flex-direction: column;
  }

  .android-sidebar {
    width: auto;
    flex: 0 0 auto;
  }

  .android-drop {
    flex-direction: column;
  }
}
