:root {
  --velikost-pisma: clamp(1.5rem, 12vmin, 8rem);

  /* Light theme default */
  --bg-displej: #eee;
  --text-vstup: #333;
  --text-vystup: #000;

  --bg-numeric: #ddd;
  --bg-function: #bbb;
  --bg-other: #999;
}

[data-theme="dark"] {
  --bg-displej: #111;
  --text-vstup: #ccc;
  --text-vystup: #fff;

  --bg-numeric: #444;
  --bg-function: #555;
  --bg-other: #666;
}

[data-theme="ocean"] {
  --bg-displej: #002f3d;
  --text-vstup: #cce3e9;
  --text-vystup: #ffffff;

  --bg-numeric: #3a7ca5;
  --bg-function: #5fb3b3;
  --bg-other: #4d869c;
}

body {
  margin: 0;
  font-family: sans-serif;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  background: var(--bg-displej);
  color: var(--text-vystup);
}

hr {
  width: 100%;
  height: 2px; /* tloušťka čáry */
  background-color: var(--text-vystup);
  border: none;
  margin: 1rem 0;
}

#displej {
  /*height: 30%;*/
  flex: 1 1 auto;
  display: flex;
  max-height: 50dvh;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-displej);
  padding: 0.5rem;
  gap: 0.5rem;
}

#statusbar, #swipbox {
  display: flex;
}

#statusbar span, #swipbox button {
  flex: 1;
}


#vstup,
#vystup {
  font-size: calc(var(--velikost-pisma) * 1.1);
  text-align: right;
  font-weight: bold;
  background: transparent;
  border: none;
  overflow-x: auto;
  white-space: nowrap;
  user-select: text;
  -webkit-overflow-scrolling: touch;
}

#vstup,
#statusbar {
  color: var(--text-vstup);
}

#vystup {
  color: var(--text-vystup);
}

#klavesnice {
  flex-shrink: 0;
  flex-grow: 4;
  margin-top: auto;
  touch-action: none;
  display: grid;
  /* grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;*/
  gap: 0.3rem;
  padding: 0.3rem;
}

#klavesnice,
#klavesnice * {
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.vyssi {
  padding: 1%;
}

.swipi {
  flex-grow: 1;
}

.numeric {
  background: var(--bg-numeric);
}

.function {
  background: var(--bg-function);
}

.other {
  background: var(--bg-other);
}

.numeric,
.function,
.other {
  color: var(--text-vystup);
}

.key-button {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--velikost-pisma);
  line-height: 1;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.05s;
  /* background: none; */
}

.key-main {
  position: relative;
  z-index: 1;
}

.key-alt {
  position: absolute;
  top: 0.1em;
  right: 0.3em;
  font-size: 0.4em;
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  transition: all 0.2s ease;
}

.key-button.show-alt .key-alt {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  /* font-size: 1em; */
  font-size: var(--velikost-pisma);
  opacity: 1;
  color: var(--text-vystup);
  transform: translate(-50%, -50%);
  z-index: 2;
}

.key-button.show-alt .key-main {
  opacity: 0;
}

 @media (orientation: portrait) {
  .swipi {
    display: none;
    flex: 0;
  }

  #klavesnice {
    width: 100dvw;
  }
  .key-button {
    aspect-ratio: 1 / 1;
  }

  .key-button.wide {
    aspect-ratio: auto;
  }
}