Files
tictactoecss/template.tictactoe.css

249 lines
4.3 KiB
CSS

body {
text-align: center;
margin: 0;
}
.tic-tac-toe {
font-family: 'Open Sans', sans-serif;
height: 440px;
width: 440px;
margin: 50px auto 30px auto;
position: relative;
}
.tic-tac-toe .grid {
background-color: grey;
position: absolute;
display: block;
border-radius: 3px;
}
.tic-tac-toe .horizontal-bar-1 {
top: 140px;
bottom: 290px;
height: 10px;
width: 440px
}
.tic-tac-toe .horizontal-bar-2 {
top: 290px;
bottom: 140px;
height: 10px;
width: 440px
}
.tic-tac-toe .vertical-bar-1 {
left: 140px;
right: 290px;
height: 440px;
width: 10px;
}
.tic-tac-toe .vertical-bar-2 {
left: 290px;
right: 140px;
height: 440px;
width: 10px;
}
.tic-tac-toe label {
height: 140px;
width: 140px;
display: none;
opacity: 0.0;
position: absolute;
cursor: pointer;
-moz-transition: background-color 0.3s;
-o-transition: background-color 0.3s;
-webkit-transition: background-color 0.3s;
transition: background-color 0.3s;
}
.tic-tac-toe label:hover {
opacity: 0.2;
}
.tic-tac-toe input {
display: none;
}
.tic-tac-toe input.turn-0 + label {
z-index: 0;
display: block;
}
.tic-tac-toe input.col-0 + label {
left: 0px;
right: 300px;
}
.tic-tac-toe input.col-1 + label {
left: 150px;
right: 150px;
}
.tic-tac-toe input.col-2 + label {
left: 300px;
right: 0px;
}
.tic-tac-toe input.row-0 + label {
top: 0px;
bottom: 300px;
}
.tic-tac-toe input.row-1 + label {
top: 150px;
bottom: 150px;
}
.tic-tac-toe input.row-2 + label {
top: 300px;
bottom: 0px;
}
/* CSS for creating the O and X check marks on the field. */
.tic-tac-toe .circle {
position: absolute;
height: 100px;
width: 100px;
margin: 10px;
border: 10px solid #dc685a;
border-radius: 50%;
}
.tic-tac-toe .cross {
position: absolute;
width: 140px;
height: 140px;
display: block;
transform:rotate(45deg);
-ms-transform:rotate(45deg);
-webkit-transform:rotate(45deg);
}
.tic-tac-toe .cross:before, .cross:after {
content: "";
position: absolute;
background: #78bec5;
border-radius: 3px;
}
.tic-tac-toe .cross:before {
top: 65px;
bottom: 65px;
left: 0px;
right: 0px;
height: 10px;
width: 140px;
}
.tic-tac-toe .cross:after {
left: 65px;
right: 65px;
height: 140px;
width: 10px;
}
.tic-tac-toe .end {
width: 440px;
height: 440px;
padding-top: 125px;
position: absolute;
display: none;
background-color: #ecaf4f;
color: #3d4250;
text-align: center;
z-index: 11;
background: rgba(255, 255, 255, 0.8);
border-radius: 3px;
}
.tic-tac-toe .end h1 {
margin: 40px;
}
.tic-tac-toe .end a {
background-color: #3d4250;
border-radius: 3px;
text-decoration: none;
color: #fff;
padding: 10px;
}
/*
Rules for player moves. Make selected field permanently visible and make next
board visible. The next player board is the current turn + 2 because every
second board is for the bot.
*/
{%- for turn in turns_player %}
.tic-tac-toe input.turn-{{turn}}:checked + label {
cursor: default;
opacity: 1.0;
z-index: 10 !important;
}
.tic-tac-toe input.turn-{{turn}}:checked ~ .turn-{{turn + 2}} + label {
z-index: {{turn + 2}};
display: block;
}
{% endfor %}
/* BEGIN: bot_move_rules */
{% for rule in bot_move_rules %}
.tic-tac-toe
{% for move in rule.moves -%}
input.turn-{{move.turn}}.field-{{move.field}}:checked ~
{% endfor -%}
input.turn-{{rule.next_move.turn}}.field-{{rule.next_move.field}} + label {
display: block;
cursor: default;
opacity: 1.0;
z-index: 10 !important;
}
{% endfor %}
/* END: bot_move_rules */
/* BEGING: Rules for when the bot has won. */
{% for rule in win_rules %}
.tic-tac-toe
{% for move in rule.moves -%}
input.turn-{{move.turn}}.field-{{move.field}}:checked ~
{% endfor -%}
.end {
display: block;
}
.tic-tac-toe
{% for move in rule.moves -%}
input.turn-{{move.turn}}.field-{{move.field}}:checked ~
{% endfor -%}
.end > h1:before {
content: "Bot wins!" !important;
}
{% endfor %}
/* END: Rules for when the bot has won. */
/* BEGING: draws */
{% for rule in draw_rules %}
.tic-tac-toe
{% for move in rule.moves -%}
input.turn-{{move.turn}}.field-{{move.field}}:checked ~
{% endfor -%}
.end {
display: block;
}
.tic-tac-toe
{% for move in rule.moves -%}
input.turn-{{move.turn}}.field-{{move.field}}:checked ~
{% endfor -%}
.end > h1:before {
content: "Tied!" !important;
}
{% endfor %}
/* END: draws */