@import '../assets/css/index.css';

body {
  overflow: hidden;
}

.fl-shell-body {
  display: grid;
  grid-template-columns: auto;

  .fl-shell.-app-create & {
    place-content: safe center;
    gap: 0.5lh;
    padding: 2ch calc(1ch + env(safe-area-inset-right)) calc(2ch + env(safe-area-inset-bottom))
      calc(1ch + env(safe-area-inset-left));
    font-size: clamp(1rem, 10cqmin, 3.6rem);
  }

  .fl-shell.-app-play & {
    padding: 2ch calc(2ch + env(safe-area-inset-right)) 2ch calc(2ch + env(safe-area-inset-left));

    @media (height < 444px) and (orientation: landscape) {
      padding: 0 calc(2ch + env(safe-area-inset-right)) 0 calc(2ch + env(safe-area-inset-left));
    }
  }
}

.app-hero {
  min-inline-size: 12ch;
}

.app-hero-actions {
  display: flex;
  gap: 0.25ch;
}

.app-select {
  display: block;
  inline-size: var(--fl-size-stretch);
  border-radius: 0.5ch;
  color: oklch(var(--fl-color-60) var(--fl-color-theme));
  font-weight: 700;

  &:focus-visible {
    text-decoration: underline;
  }
}

.app-room {
  container-type: size;
  display: grid;
  place-content: center;
  overflow: hidden;
}

.app-table {
  block-size: 100cqb;
  inline-size: 100cqi;
  touch-action: none;

  @media (height < 444px) and (orientation: landscape) {
    block-size: 100cqi;
    inline-size: 100cqb;
    rotate: -90deg;
  }
}

.app-table-image {
  block-size: 100%;
  inline-size: 100%;
  stroke-linecap: round;
  pointer-events: none;
}

.app-table-rail {
  x: -40px;
  y: -40px;
  width: 100%;
  height: 100%;
  rx: 40px;
  ry: 40px;
  fill: oklch(var(--fl-color-15) var(--fl-color-theme));
}

.app-table-cushion {
  x: -10px;
  y: -10px;
  width: calc(100% - 60px);
  height: calc(100% - 60px);
  rx: 10px;
  ry: 10px;
  fill: oklch(var(--fl-color-30) var(--fl-color-theme));
}

.app-table-counter {
  stroke: oklch(var(--fl-color-75) var(--fl-color-theme));
  stroke-width: 5;

  &.-shots {
    stroke: oklch(var(--fl-color-99) var(--fl-color-theme));
  }

  &.-track {
    stroke: oklch(var(--fl-color-05) var(--fl-color-themeGray));
  }

  &:not(.-visible) {
    display: none;
  }
}

.app-table-field {
  x: 0;
  y: 0;
  width: calc(100% - 80px);
  height: calc(100% - 80px);
  fill: oklch(var(--fl-color-05) var(--fl-color-themeGray));

  &.-secondary {
    fill: oklch(var(--fl-color-05) var(--fl-color-themeGray) / 75%);
  }
}

.app-table-pocket {
  cx: 0;
  cy: 0;
  fill: oklch(var(--fl-color-05) var(--fl-color-themeGray));
  stroke: oklch(var(--fl-color-30) var(--fl-color-theme));
  stroke-width: 2;
}

.app-table-ball {
  cx: 0;
  cy: 0;
  fill: oklch(var(--fl-color-60) var(--fl-color-theme));

  :nth-child(1 of &) {
    fill: oklch(var(--fl-color-99) var(--fl-color-theme));
  }

  &.-sinking {
    scale: 0;
    transition:
      translate 0.25s cubic-bezier(0.2, 1.2, 0.5, 1.5),
      scale 0.5s 0.125s ease-in-out;
  }
}

.app-table-aim {
  &:not(.-visible) {
    display: none;
  }
}

.app-table-aim-power {
  fill: none;
  stroke: oklch(var(--fl-color-99) var(--fl-color-theme));
  stroke-width: 4;
  stroke-linecap: round;

  &.-track {
    stroke: oklch(var(--fl-color-45) var(--fl-color-themeGray));
    stroke-width: 3;
  }

  &:not(.-visible) {
    display: none;
  }
}

.app-table-aim-path {
  stroke: oklch(var(--fl-color-30) var(--fl-color-themeGray));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;

  &.-secondary {
    stroke: oklch(var(--fl-color-45) var(--fl-color-theme));
    stroke-dasharray: 1 6;
    stroke-dashoffset: 3;
  }

  &.-tertiary {
    stroke: oklch(var(--fl-color-45) var(--fl-color-themeGray));
    stroke-dasharray: 1 6;
    stroke-dashoffset: 3;
  }

  &:not(.-visible) {
    display: none;
  }
}

.app-table-aim-ghost {
  stroke: oklch(var(--fl-color-30) var(--fl-color-themeGray));
  stroke-width: 2;

  &:not(.-visible) {
    display: none;
  }
}

.app-table-touch {
  &:not(.-visible) {
    display: none;
  }
}

.app-table-touch-line {
  stroke: oklch(var(--fl-color-99) var(--fl-color-theme));
  stroke-width: 2;
}

.app-table-touch-start {
  stroke: oklch(var(--fl-color-30) var(--fl-color-themeGray));
  stroke-dasharray: 1 6;
  stroke-width: 2;
}

.app-keyboard {
  display: flex;
  flex-flow: column;
  gap: 0.75ch 0.5ch;
  max-inline-size: 36ch;
  margin-inline: auto;
  padding: 1ch 1.5ch;
  font-size: clamp(1rem, 5cqw, 1.5rem);

  @media (height < 444px) and (orientation: landscape) {
    font-size: clamp(1rem, 2.5cqw, 1.5rem);
  }
}

.app-keyboard-row {
  display: flex;
  flex-flow: row;
  gap: 0.5ch;
  justify-content: safe center;
}
