:root {
    font-size: 24px;
    font-weight: 700;
    font-family: "Space Mono", monospace;
    --primary-green-400: hsl(172, 67%, 45%);
    --red: hsl(0, 100%, 64%);
    --green-900: hsl(183, 100%, 15%);
    --grey-500: hsl(186, 14%, 43%);
    --grey-400: hsl(184, 14%, 56%);
    --grey-200: hsl(185, 41%, 84%);
    --grey-50: hsl(189, 47%, 97%);
    --white: hsl(0, 100%, 100%);
}

body {
    margin: 0;
    background: var(--grey-200);
}

main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: center;
}

.container {
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.container h1 {
    font-size: 1rem;
    letter-spacing: .5rem;
    max-width: 4.5rem;
    text-transform: uppercase;
    word-break: break-all;
    color: var(--green-900);
}

.main-card {
    background: var(--white);
    display: flex;
    border-radius: .8rem;
    box-shadow: 0 .8rem 1rem rgba(88, 88, 88, 0.1);
    padding: 1rem;
    gap: 1rem;
    max-width: 865px;
    box-sizing: border-box;
}

.main-card form {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    gap: 1.5rem;
    padding: .5rem;
}

.input-head {
    font-size: .6rem;
    margin-bottom: .2rem;
    display: flex;
    justify-content: space-between;
}

.input-head label {
    color: var(--grey-500);
}

.input-head .error-message {
    color: var(--red);
}

.input-head .error-message.hide {
    display: none;
}

input {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    text-align: right;
    font-size: 1rem;
    background: var(--grey-50);
    border-radius: .2rem;
    padding: 0 .45rem;
    font-family: "Space Mono", monospace;
    color: var(--green-900);
    border: 2px solid transparent;
    height: 2rem;
}

input.inner-icon {
    background-repeat: no-repeat;
    background-position: .5rem 50%;
    padding-left: 1.4rem;
}

.dolar-icon {
    background-image: url("./images/icon-dollar.svg");
}

.person-icon {
    background-image: url("./images/icon-person.svg");
}

input:focus {
    border: 2px solid var(--primary-green-400);
    outline: none;
    box-shadow: none;
}

input.error {
    border: 2px solid var(--red);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

#tip-input {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 2rem;
    gap: .5rem;
}

#tip-input[data-active="5"] button[data-type="5"],
#tip-input[data-active="10"] button[data-type="10"],
#tip-input[data-active="15"] button[data-type="15"],
#tip-input[data-active="25"] button[data-type="25"],
#tip-input[data-active="50"] button[data-type="50"] {
    color: var(--green-900);
    background: var(--primary-green-400);
}

button {
    font-size: 1rem;
    color: var(--white);
    background: var(--green-900);
    border-radius: .2rem;
    border: none;
    cursor: pointer;
    height: 2rem;
    font-family: "Space Mono", monospace;
    text-transform: uppercase;
}

button:hover {
    color: var(--green-900);
    background: var(--grey-200);
}

button:active {
    transform: scale(.95);
}

.reset-button {
    color: var(--green-900);
    background: var(--primary-green-400);
    margin-top: auto;
}

.main-card .screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--green-900);
    color: var(--white);
    border-radius: .6rem;
    padding: 1rem;
    box-sizing: border-box;
}

.screen > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: .5rem 0;
}

.title-container {
    display: flex;
    flex-direction: column;
}

.title-container .title {
    font-size: .65rem;
}

.title-container .subtitle {
    font-size: .55rem;
    color: var(--grey-400);
}

.amount {
    font-size: 2rem;
    color: var(--primary-green-400);
}

@media screen and (max-width: 865px) {
    main {
        padding: 1rem;
    }

    #tip-input {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 680px) {
    .main-card {
        flex-direction: column;
    }
}

@media screen and (max-width: 425px) {
    main {
        padding: 1rem 0 0 0;
    }

    .main-card {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
}