/* ===== Общий стиль ===== */
body {
  font: 100% / 1.125 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Helvetica, sans-serif, 'GNU Unifont';
  background-color: #fffdf8;
  color: #111;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

a {
  color: #900;
  text-decoration: underline;
}
a:hover {
  color: #c00;
  text-decoration: none;
}

/* ===== Навигация ===== */
nav {
  background-color: #fff7e7;
  border-bottom: 4px solid #900;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  padding-right: 21rem;
  box-sizing: border-box;
}

.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  flex-grow: 1;
}

nav button, nav input, nav .button {
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
  border: 1px solid #900;
  color: #900;
  border-radius: 0.2rem;
  padding: 0.3rem 0.6rem;
}

nav button, nav .button {
  cursor: pointer;
}

nav input {
  border: 1px solid #ccc;
  color: #111;
}

nav .button {
  text-decoration: none;
  color: white;
  background: #900;
  line-height: 1;
  padding-top: 0.1rem;
  padding-bottom: 0.1rem;
  text-align: center;
  margin-left: .2rem;
  z-index: 1;
}

nav .clear-btn {
  align-self: stretch;
  width: 2rem;
  padding: 0;
  position: relative;
  display: block;
  margin-left: 0.2rem;
  box-sizing: border-box;
}

nav .clear-btn:disabled {
  cursor: default;
  opacity: .5;
}

nav .clear-btn:disabled:hover {
  background: #fff;
}

nav .clear-btn::before,
nav .clear-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60%;
  height: 2px;
  background: currentColor;
  transform-origin: center;
  transition: background 0.2s;
}

nav .clear-btn::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
nav .clear-btn::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

nav button:hover {
  background: #f0f0f0;
}

/* ===== Селектор и вкладки ===== */
#selector {
  border-top: 1px solid #ccc;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
}

#selector button {
  background: #f7f7f7;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  padding: 0.3rem 0.6rem;
  margin: 0.25rem;
}

#selector button.active {
  background: #900;
  color: #fffdf8;
  border-color: #900;
  font-weight: bold;
}

#selector button.dimmed {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ===== Основная часть ===== */
#tabs {
  padding: 1rem 2rem;
  padding-right: 21rem;
  box-sizing: border-box;
}

.section {
  border-top: 1px solid #ccc;
  margin-top: 1rem;
  padding-top: 1rem;
  position: relative;
}

.section::before {
  content: attr(data-label);
  position: absolute;
  color: #ccc;
  top: -0.75rem;
  left: 50%;
  transform: translate(-50%);
  background: #fffdf8;
  padding: 0 1rem;
}

.section.empty {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.section.empty::before {
  content: none;
}

#tabs label {
  display: flex;
  padding: 0.35rem 0;
  cursor: pointer;
  align-items: flex-start;
  justify-content: flex-start;
  line-height: 1.1rem;
  width: 100%;
  box-sizing: border-box;
}

#tabs label:hover {
  background-color: #f3f3f3;
}

#tabs label.selected {
  background: #fdf3f3;
  font-weight: bold;
  border-left: 4px solid #900;
  padding-left: 0.6rem;
}

#tabs label input {
	margin-right: 6px;
}

.name {
  flex-grow: 1;
}

.tag-en {
  color: #999;
  font-size: 0.9rem;
}

.popularity {
  text-align: right;
  font-size: 0.8rem;
  color: #aaa;
  padding-left: 1rem;
  white-space: nowrap;
}

.popularity::before {
  content: 'x ';
}

/* ===== Панель вывода ===== */
#output {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20rem;
  background-color: #fff;
  border-left: 1px solid #ccc;
  padding: 1rem;
  overflow-y: auto;
  box-sizing: border-box;
}

#output h2 {
	text-align: center;
  color: #900;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

#output textarea {
	width: 100%;
  height: 18rem;
  padding: 0.5rem;
  border: 1px solid #ccc;
  font-family: monospace;
  font-size: 0.9rem;
  background-color: #fdfdfd;
	box-sizing: border-box;
}

#output button {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.4rem 0.8rem;
  border-radius: 3px;
  border: 1px solid #900;
  background-color: #fffdf8;
  color: #900;
  cursor: pointer;
}
#output button:hover {
  background-color: #900;
  color: #fffdf8;
}

#but_copy {
  float: right;
}

@media (max-width: 900px) {
  body {
    font-size: 0.9rem;
  }

  #filter {
    width: 10rem;
  }

  nav {
    padding-right: 17rem;
  }
  
  nav button, nav input, nav .button {
    padding: 0.2rem 0.4rem;
  }
  
  #tabs {
    padding-right: 17rem;
    padding-left: 1rem;
  }

  #selector button {
    padding: 0.2rem 0.4rem;
    font-size: 0.9rem;
  }

  #output {
    width: 16rem;
  }

  #output h2 {
    font-size: 1.1rem;
  }
}

@media (max-width: 600px) {
  nav {
    padding-right: 1rem;
  }
  
  #tabs {
    padding-right: 1rem;
    padding-bottom: 11rem;
  }

  #output {
    left: 0;
    top: unset;
    height: 10rem;
    width: unset;
    display: flex;
    align-items: center;
    padding-left: 0.5rem;
  }

  #output h2 {
    transform: rotate(-90deg);
    margin-top: 0;
  }

  #output textarea {
    height: 100%;
  }

  .buttons {
    padding-left: 1rem;
  }

  #output button {
    float: none;
    width: 100%;
    display: block;
  }
}