html, body {
  height: 100%;
  margin: 0;
  background-color: cadetblue;
}

.main_container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ---------- top bar ---------- */
#menu {
  height: 10%;
  min-height: 48px;
  background-color: rgb(239 239 239);
  display: flex;
  justify-content: flex-start;
  flex-direction: row-reverse;
  align-items: center;
  position: relative;
}
#menu h3 { margin: 0 12px; }
.icon { height: 100%; }
.icon img, img.icon { height: 100%; }

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #f1f1f1;
  min-width: 250px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  z-index: 1001;
}
.dropdown-item {
  color: black;
  background-color: #ffffff;
  padding: 12px 16px;
  display: block;
  cursor: pointer;
  font-size: 25px;
  text-align: right;
}

/* ---------- list chooser ---------- */
#choose_lists {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  max-height: 80%;
  overflow-y: auto;
  padding: 16px 0;
  background-color: white;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  gap: 16px;
  z-index: 1000;
}

/* ---------- main area ---------- */
#items_container {
  flex: 1;
  min-height: 0;
  display: flex;
}

#selected_items {
  width: 25%;
  background-color: #efefef;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#items {
  width: 75%;
  background-color: aquamarine;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#items_grid {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 10px 0 20px;
}

#input {
  min-height: 68px;
  width: 100%;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
}
#input h1 { margin: 0; }
#clear_input_btn { display: none; margin-left: 10px; }

/* ---------- letters bar ---------- */
#letters {
  height: 15%;
  min-height: 56px;
  background-color: white;
  display: flex;
  justify-content: space-around;
  flex-direction: row-reverse;
  align-items: center;
}

.letter {
  height: 25px;
  display: inline-block;
  padding: 10px;
  font-size: 28px;
  cursor: pointer;
  text-align: center;
  color: #000000;
  background-color: aquamarine;
  border-radius: 15px;
  box-shadow: 0 9px aquamarine;
  width: 20px;
  user-select: none;
  -webkit-user-select: none;
}
.letter:active {
  background-color: #3e8e41;
  box-shadow: 0 5px #666;
  transform: translateY(4px);
}

/* ---------- item stickers ---------- */
.item {
  display: flex;
  background-color: #3DD1E7;
  border: 0 solid #E5E7EB;
  box-sizing: border-box;
  color: #000000;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1.75rem;
  padding: .75rem 1.65rem;
  position: relative;
  text-align: center;
  width: auto;
  height: fit-content;
  max-width: 460px;
  cursor: pointer;
  transform: rotate(-2deg);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.item:after {
  content: '';
  position: absolute;
  border: 1px solid #000000;
  bottom: 4px;
  left: 4px;
  width: calc(100% - 1px);
  height: calc(100% - 1px);
  pointer-events: none;
}
.item:hover:after { bottom: 2px; left: 2px; }

@media (min-width: 768px) {
  .item { padding: .75rem 3rem; font-size: 1.25rem; }
}

/* ---------- cart (selected) ---------- */
@keyframes pulse {
  from { background-color: #FF4742; }
  to   { background-color: rgb(64, 0, 255); }
}

.selected_item {
  background: #FF4742;
  border: 1px solid #FF4742;
  animation: pulse 2s infinite alternate;
  border-radius: 6px;
  box-shadow: rgba(0, 0, 0, 0.1) 1px 2px 4px;
  box-sizing: border-box;
  color: #FFFFFF;
  cursor: pointer;
  display: block;
  font-family: nunito, roboto, proxima-nova, sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 16px;
  min-height: 40px;
  padding: 12px 14px;
  text-rendering: geometricprecision;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  margin-bottom: 2px;
  text-align: end;
}
.selected_item.armed {
  animation: none;
  background-color: #dbcaca;
  border-color: #dbcaca;
  cursor: default;
}

.remove_selected_item_btn {
  height: 100%;
  width: 20%;
}

@media screen and (max-width: 750px) {
  #selected_items { width: 30%; }
  #items { width: 70%; }
  .letter { width: 13px; height: auto; }
  #letters { z-index: 1000; background-color: black; }
}

.selected_category {
  flex: 0 0 auto;
  background: #333;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  padding: 3px 6px;
  margin: 6px 0 3px;
  border-radius: 4px;
  text-align: center;
}

/* ---------- portrait phone: one pane at a time ---------- */
#view_toggle { display: none; }
@media screen and (max-width: 750px) and (orientation: portrait) {
  #view_toggle {
    display: block;
    margin: 0 auto 0 8px;
    padding: 6px 14px;
    font-size: 18px;
    font-weight: 700;
    border: 2px solid #000;
    border-radius: 18px;
    background: aquamarine;
    cursor: pointer;
  }
  #selected_items, #items { width: 100%; }
  body[data-view="list"] #items,
  body[data-view="list"] #letters { display: none; }
  body[data-view="items"] #selected_items { display: none; }
  body[data-view="list"] .selected_item { font-size: 26px; padding: 16px 18px; }
  #letters {
    height: auto;
    display: grid;
    direction: rtl;
    grid-template-columns: repeat(var(--cols, 11), 1fr);
    grid-auto-rows: auto;
    gap: 6px 4px;
    padding: 6px 4px 8px;
    box-sizing: border-box;
  }
  #letters .letter {
    width: auto;
    height: auto;
    padding: 6px 0;
    font-size: 22px;
    line-height: 1.2;
    box-shadow: 0 4px aquamarine;
    border-radius: 10px;
  }
}
