:root 
{
    --primary-color: #000000;
    --secondary-color: #707070;
    --placeholder-color: #8A898E;
    --destroy-color: #FD3C31;
    --vh: 100vh;
}

::placeholder {
    color: var(--placeholder-color);
    opacity: 1;
}

html, body 
{
    margin: 0;
    padding: 0;
    height: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    height: -moz-available;
    height: fill-available;
    height: stretch;
}

html 
{
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: 17px;
    line-height: 1.3em;
}

body 
{
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    background-color: black;
}

@media (min-width: 768px) {
    body {
        background-size: 768px auto;
    }
}

input,
textarea,
button,
figure
{
    margin: 0;
    padding: 0;
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    border: none;
    resize: none;
    outline: none;
    border-radius: 0;
    appearance: none;
    background-image: none;
    background-color: transparent;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    line-height: inherit;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
}

button 
{
    background: #1C1C1E;
    border-radius: 4px;
    padding: 5px 10px;
}

@media (pointer: fine) {
    button:not(:disabled):hover {
        background-color: #2C2C2E;
    }
}

button.destroy 
{
    color: var(--destroy-color);
}

button.done 
{
    font-weight: 500;
}

button:disabled 
{
    color: #8F8E93;
}

button:not(:disabled)
{
    cursor: pointer;
}

textarea 
{
    resize: none;
}

.screen
{
    position: relative;
    flex-grow: 1;
    width: 100%;
    max-width: 100%;
}

.items-left 
{
    position: fixed;
    display: flex;
    top: 5px;
    left: 10px;   
    left: calc(10px + env(safe-area-inset-left));
}

.items-left > *:not(:first-child) 
{
    margin-left: 10px;
}

.items-right 
{
    position: fixed;
    display: flex;
    top: 5px;
    right: 10px;
    right: calc(10px + env(safe-area-inset-right));
}

.items-right > *:not(:last-child) 
{
    margin-right: 10px;
}

.secondary
{
    color: var(--secondary-color);
}

.caption 
{
    font-size: 0.7em;
    line-height: 1.17em;
}

.destroy 
{
    color: var(--destroy-color);
}

x-authentication-button
{
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 100%;
    border: none;
    background-image: url('img/icon-lock.svg');
    background-repeat: no-repeat;
    background-size: 50%;
    background-position: center;
    background-color: #1C1C1E;
    appearance: none;
}

x-authentication-button[authenticated] 
{
    background-image: url('img/icon-unlock.svg');
}

x-authentication-button:not([disabled]) 
{
    cursor: pointer;
}

x-authentication-button[disabled] 
{
    opacity: 0.1;
}

@media (pointer: fine) {
    x-authentication-button:hover {
        background-color: #2C2C2E;
    }
}

x-reload-button
{
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 100%;
    border: none;
    background-image: url('img/icon-refresh.svg');
    background-repeat: no-repeat;
    background-size: 50%;
    background-position: center;
    background-color: #1C1C1E;
    appearance: none;
}

x-reload-button:not([disabled]) 
{
    cursor: pointer;
}

x-reload-button[disabled] 
{
    opacity: 0.1;
}

@media (pointer: fine) {
    x-reload-button:hover {
        background-color: #2C2C2E;
    }
}

x-activity-indicator
{
    color: inherit;
    display: inline-block;
    position: relative;
    width: 4.7em;
    height: 4.7em;
    font-size: 6px;
}

x-activity-indicator span 
{
    display: block;
    transform-origin: 2.35em 2.35em;
    animation: activity-indicator 1.2s linear infinite;
}

x-activity-indicator span:after 
{
    content: " ";
    display: block;
    position: absolute;
    top: 0.18em;
    left: 2.18em;
    width: 0.35em;
    height: 1em;
    border-radius: 0.7em;
    background: white;
}

x-activity-indicator span:nth-child(1) {
    transform: rotate(0deg);
    animation-delay: -1.1s;
}

x-activity-indicator span:nth-child(2) {
    transform: rotate(30deg);
    animation-delay: -1s;
}

x-activity-indicator span:nth-child(3) {
    transform: rotate(60deg);
    animation-delay: -0.9s;
}

x-activity-indicator span:nth-child(4) {
    transform: rotate(90deg);
    animation-delay: -0.8s;
}

x-activity-indicator span:nth-child(5) {
    transform: rotate(120deg);
    animation-delay: -0.7s;
}

x-activity-indicator span:nth-child(6) {
    transform: rotate(150deg);
    animation-delay: -0.6s;
}

x-activity-indicator span:nth-child(7) {
    transform: rotate(180deg);
    animation-delay: -0.5s;
}

x-activity-indicator span:nth-child(8) {
    transform: rotate(210deg);
    animation-delay: -0.4s;
}

x-activity-indicator span:nth-child(9) {
    transform: rotate(240deg);
    animation-delay: -0.3s;
}

x-activity-indicator span:nth-child(10) {
    transform: rotate(270deg);
    animation-delay: -0.2s;
}

x-activity-indicator span:nth-child(11) {
    transform: rotate(300deg);
    animation-delay: -0.1s;
}

x-activity-indicator span:nth-child(12) {
    transform: rotate(330deg);
    animation-delay: 0s;
}

@keyframes activity-indicator 
{
    0%      { opacity: 1; }
    100%    { opacity: 0; }
}

/**
 * Screen: Home
 */
 .screen-home
 {
     display: grid;
     grid-template-columns: 100%;
     grid-template-rows: 46px 1fr auto 1fr 46px;
     grid-template-areas:
         "top"
         "header"
         "main"
         "footer"
         "bottom";
     justify-items: center;
     max-height: 100%;
     overflow: hidden;    
 }
 
 .screen-home > header,
 .screen-home > main
 {
     display: contents;
 }
 
 .screen-home > header > .logo
 {
     grid-area: header;
 }
 
 .screen-home > header > .logo,
 .screen-home > header > .logo > img 
 {
     display: block;
     height: 20vh;
     min-height: 0;
     max-width: 100%;
     max-height: 78px;
 }
 
 .screen-home > main > p 
 {
     grid-area: main;
     text-align: center;
 }

/**
 * Screen: No Card
 */
.screen-no-card
{
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: 46px 1fr auto 1fr 46px;
    grid-template-areas:
        "top"
        "header"
        "main"
        "footer"
        "bottom";
    justify-items: center;
    max-height: 100%;
    overflow: hidden;    
}

.screen-no-card > header,
.screen-no-card > main
{
    display: contents;
}

.screen-no-card > header > .logo
{
    grid-area: header;
}

.screen-no-card > header > .logo,
.screen-no-card > header > .logo > img 
{
    display: block;
    height: 20vh;
    min-height: 0;
    max-width: 100%;
    max-height: 78px;
}

.screen-no-card > main > p 
{
    grid-area: main;
    text-align: center;
}

/**
 * Screen: Card
 */
.screen-card
{
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: 46px 1fr auto 1fr 46px;
    grid-template-areas:
        "top"
        "header"
        "main"
        "footer"
        "bottom";
    justify-items: center;
    max-height: 100%;
    overflow: hidden;
}

.screen-card > header,
.screen-card > main
{
    display: contents;
}

.screen-card > header > .logo
{
    grid-area: header;
}

.screen-card > header > .logo,
.screen-card > header > .logo > img 
{
    display: block;
    height: 20vh;
    min-height: 0;
    max-width: 100%;
    max-height: 78px;
}

.screen-card > main
{
    max-width: 100%;
    max-height: 100%;
}

.screen-card > main > .qrcode
{
    grid-area: main;
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    padding: 20px;
}

.screen-card > main > .qrcode > .frame
{
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    padding: 15px;
    max-height: 100%;
    min-height: 0;   
}

.screen-card > main > .qrcode > .frame > img
{
    display: block;
    width: 100%;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
}

@media (orientation: portrait) and (min-width:440px) 
{
    .screen-card > main > .qrcode > .frame
    {
        width: 400px;
    }
}

.screen-card > header > p.description
{
    grid-area: footer;
    margin: 0;
    display: flex;
    text-align: center;
    align-items: end;
    width: 75%;
    max-width: 250px;
    padding-bottom: env(safe-area-inset-bottom);
}

@media (orientation: landscape) 
{
    .screen-card
    {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: none;
        grid-template-areas: none;
        align-items: center;
    }

    .screen-card > header
    {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        
        padding-top: 46px;
        padding-bottom: 46px;
        padding-left: 20px;
        padding-left: calc(20px + env(safe-area-inset-left));
        padding-right: 0;

        box-sizing: border-box;
    }

    .screen-card > header > .logo,
    .screen-card > header > .logo > img 
    {
        height: 50vh;
        max-height: 11vw;
    }

    .screen-card > header > p.description
    {
        padding-top: 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .screen-card > main
    {
        display: flex;
        width: 100%;
        height: 100%;
        overflow: hidden;
        flex-direction: column;
        justify-content: center;

        padding-top: 46px;
        padding-bottom: 46px;
        padding-left: 0;
        padding-right: 20px;
        padding-right: calc(20px + env(safe-area-inset-right));
        
        box-sizing: border-box;
    }

    .screen-card > main > .qrcode
    {
        display: block;
        width: min(50vw - 20px - env(safe-area-inset-right), var(--vh) - 92px - env(safe-area-inset-bottom));
        height: min(50vw - 20px - env(safe-area-inset-right), var(--vh) - 92px - env(safe-area-inset-bottom));
        padding: 0;
    }
}

@media (orientation: landscape) and (min-width: 1024px) 
{
    .screen-card 
    {
        max-width: 1024px;
    }

    .screen-card > header > .logo,
    .screen-card > header > .logo > img 
    {
        max-height: 120px;
    }  

    .screen-card > main > .qrcode
    {
        display: block;
        width: min(512px - 20px - env(safe-area-inset-right), var(--vh) - 92px - env(safe-area-inset-bottom));
        height: min(512px - 20px - env(safe-area-inset-right), var(--vh) - 92px - env(safe-area-inset-bottom));
    }
}

/**
 * Screen: Edit
 */
.screen-edit 
{
    max-width: 455px;
}

.screen-edit > main
{
    padding-top: 46px;
    padding-bottom: 46px;
}

.screen-edit section
{
    margin-top: 20px;
    margin-bottom: 20px;
    padding-left: 20px;
    box-sizing: border-box;
    border-color: #3D3C42;
    border-style: solid;
    border-width: 0px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    background: #1C1C1E;
}

.screen-edit section:first-child 
{
    margin-top: 0;
}

.screen-edit section:last-child 
{
    margin-bottom: 0;
}

@media (min-width: 455px) {
    .screen-edit section {
        border: none;
        border-radius: 12px;
    }
}

.screen-edit section > input,
.screen-edit section > textarea
{
    display: block;
    width: 100%;
    padding-top: 15px;
    padding-bottom: 15px;
}

.screen-edit section > input,
.screen-edit section > textarea,
.screen-edit section > button 
{
    border-color: #3D3C42;
    border-style: solid;
    border-width: 0px;
}

@media (min-width: 455px) {
    .screen-edit section > input,
    .screen-edit section > textarea,
    .screen-edit section > button 
    {
        border-color: #3D3C42;
    }
}

.screen-edit section > input:not(:last-child),
.screen-edit section > textarea:not(:last-child),
.screen-edit section > button:not(:last-child)
{
    border-bottom-width: 1px;
}

.screen-edit section > input:disabled,
.screen-edit section > textarea:disabled,
.screen-edit section > button:disabled
{
    opacity: 0.25;
}

.screen-edit section > textarea 
{
    box-sizing: content-box;
    height: 5.2em;
}

.screen-edit section > button
{
    display: block;
    width: 100%;
    padding-top: 15px;
    padding-bottom: 15px;
    background: transparent;
    border-radius: 0;
    text-align: left;
}

.screen-edit .section-photo
{
    display: flex;
    justify-content: center;
    background: transparent;
    border: none;;
}

.screen-edit .section-photo figure
{
    position: relative;
}

.screen-edit .section-photo figure > .placeholder,
.screen-edit .section-photo figure > img
{
    display: block;
    width: 168px;
    height: 168px;
    border-radius: 100%;
    object-fit: cover;
    object-position: center;
}

.screen-edit .section-photo figure > .placeholder
{
    border: 1px dashed #3D3C42; 
}

.screen-edit .section-photo figure > figcaption
{
    margin-top: 10px;
    text-align: center;
}

.screen-edit .section-photo input
{
    display: none;
}

.screen-edit .section-photo figure > button.delete 
{
    position: absolute;
    top: 0;
    right: 0;
    z-index: 999;
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 100%;
    background-image: url('img/icon-close.svg');
    background-repeat: no-repeat;
    background-size: 50%;
    background-position: center;
    background-color: #1C1C1E;
}